MCPcopy Index your code
hub / github.com/andrelandgraf/openimg

github.com/andrelandgraf/openimg @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
84 symbols 373 edges 72 files 2 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

openimg

openimg (Open Image) is a set of JavaScript packages for working with images on the web. It includes a React component, server-side code for Node and Bun, and a Vite plugin. Every part is built to work smoothly together, but you can also use them individually.

Getting started

The easiest way to get started is to integrate openimg as an image optimization endpoint on your existing server. From there, you can utilize the React component to query for optimized images and use the Vite plugin to integrate local image assets from your Vite project. You can follow the optimization endpoint guide for a step-by-step walkthrough.

Use cases & guides

API reference

  • openimg/bun: Image optimization request handler and other utilities optimized for Bun
  • openimg/node: Node-compatible image optimization request handler and other utilities for Bun, Deno, and Node
  • openimg/react: Image React component to query for optimized images
  • openimg/vite: Vite plugin for integrating local image assets from your Vite project

Changelog

Find the changelog here: CHANGELOG.md

Motivation & references

Why another image optimization package? I wanted a full-stack solution that works out of the box with minimal setup. This could have been a small wrapper around unjs/ipx and unpic/image, but I first wanted to build something from scratch and minimize dependencies (other than sharp).

The HTTP request handler is inspired by this Gist by Jacob Ebey that showcases how to use sharp with stream processing.

Extension points exported contracts — how you extend this code

Matchers (Interface)
(no doc)
tests/react/matchers.d.ts
AsymmetricMatchers (Interface)
(no doc)
tests/react/matchers.d.ts

Core symbols most depended-on inside this repo

get
called by 66
packages/core/src/utils.ts
toInclude
called by 47
tests/react/matchers.d.ts
fetch
called by 38
tests/bun/remote.ts
resolve
called by 32
packages/core/src/utils.ts
invariant
called by 16
packages/core/src/utils.ts
getImgResponse
called by 11
packages/core/src/node/index.ts
waitForServer
called by 10
tests/shared/utils.ts
getImgMetadata
called by 9
packages/core/src/meta.ts

Shape

Function 59
Method 17
Class 6
Interface 2

Languages

TypeScript100%

Modules by API surface

packages/core/src/utils.ts18 symbols
packages/core/src/node/utils.ts9 symbols
packages/core/src/bun/utils.ts9 symbols
tests/react/matchers.d.ts4 symbols
tests/react-router/app/root.tsx4 symbols
packages/core/src/react/index.tsx4 symbols
tests/shared/utils.ts3 symbols
tests/react-router/app/routes/home.tsx2 symbols
tests/bun/server-fetch-remote.ts2 symbols
tests/bun/server-custom-sharp-pipeline.ts2 symbols
tests/bun/server-custom-sharp-pipeline-no-cache.ts2 symbols
packages/core/src/vite.ts2 symbols

For agents

$ claude mcp add openimg \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact