
To resize images using URL parameters on AIOZ Pin, add img- query parameters to the gateway link that already serves your pinned image. For example, ?img-width=400&img-fit=cover returns a 400-pixel version. You don't upload a copy, call an API, or send an API key.
TL;DR:
img-width and img-fit to img-format=webp and img-onerror=redirect. At least one must be set.Updated Oct 19, 2026: added the img-format=webp option and corrected defaults (img-metadata is copyright, img-gravity is center, img-dpr tops out at 3). Also new: a fit-mode diagram, a way to measure the savings, the SDK's optimizeImage, and use cases from our image optimization overview.
Every file you pin is reachable at https://<gateway>.aiozpin.network/ipfs/<CID>, where the gateway is public or your own premium subdomain. Add query parameters to that URL and the gateway returns a transformed image, built at request time. The original stays pinned once, unchanged. This is the example from the AIOZ Pin image optimization docs:
https://premium.aiozpin.network/ipfs/bafkreiefnp4dflv35vsqzrnp25woubdbylgesttpanq6dfkctbhgo3lvy4?img-width=300&img-height=600&img-fit=coverThat URL asks for an image no wider than 300 pixels and no taller than 600, cropped to fill the box. Request the same CID with no parameters and you get the original file. The docs say at least one option must be set for optimization to run.
This matters because an original photo is often far larger than the slot it fills. A 4,000-pixel camera shot shown in a 400-pixel card wastes most of its bytes. Sending each placement the size it needs cuts transfer, which speeds up pages and lowers your bandwidth bill.
The gateway docs list 11 options. Defaults below come from the gateway docs. The img-anim default comes from the API reference, since the gateway page doesn't give one.
| Parameter | What it does | Default |
|---|---|---|
img-width | Maximum width in pixels. Exact effect depends on img-fit. If you set only the height, the width defaults to it. | 0 (source) |
img-height | Maximum height in pixels. If you set only the width, the height defaults to it. | 0 (source) |
img-fit | How width and height are applied: scale-down, contain, cover, crop, or pad | scale-down |
img-gravity | Focal point for cover: auto, top, bottom, left, right, or XxY from 0.0 to 1.0 | center |
img-quality | Quality for JPEG and WebP, 1 to 100. The docs suggest 50 for small files and 90 for high quality. | 80 |
img-format | Set to webp to serve WebP to browsers that support it | source format |
img-dpr | Device pixel ratio, 1 to 3. Multiplies width and height for high-density screens. | 1 |
img-sharpen | Sharpening strength, 0 to 10 | 0 |
img-anim | true or false: whether animated images such as GIFs stay animated or become stills | false (API reference) |
img-metadata | EXIF handling: keep (including GPS), copyright, or none | copyright |
img-onerror | Set to redirect to serve the original image if optimization fails | off |
Two details trip people up. img-quality only affects JPEG and WebP, so it does nothing to a PNG unless you also convert with img-format=webp. And img-metadata defaults to copyright, which strips GPS and camera data but keeps copyright fields. Use keep only if you want location data public.
img-fit decides what happens when your box doesn't match the photo's shape. All five modes keep the aspect ratio. The diagram shows what each one does with a 1600 x 900 photo and a 600 x 600 request.

scale-down (the default) shrinks the image to fit but never enlarges it. It's the safe choice for general resizing.contain scales up or down to fit inside the box. Use it for logos and anything that must not be cropped.cover fills the box and may crop. Use it for hero banners and fixed-shape cards, and set img-gravity to keep the subject.crop acts like scale-down for small images and like cover for large ones. It suits thumbnail grids with mixed source sizes.pad fits the image and fills the rest, usually with white. For a transparent look, the docs suggest CSS object-fit: contain instead.With cover, img-gravity=auto picks the main focus area for you. Use top, left, and so on, or a coordinate such as 0.5x0.2, when you know where the subject sits.
Because the transform is only a query string, a standard srcset works with no build step. One pinned file and one CID give you three delivered sizes, and the browser picks the one that fits:
<img
src="https://<gateway>.aiozpin.network/ipfs/<CID>?img-width=800&img-format=webp"
srcset="
https://<gateway>.aiozpin.network/ipfs/<CID>?img-width=400&img-format=webp 400w,
https://<gateway>.aiozpin.network/ipfs/<CID>?img-width=800&img-format=webp 800w,
https://<gateway>.aiozpin.network/ipfs/<CID>?img-width=1200&img-format=webp 1200w
"
sizes="(max-width: 600px) 400px, 800px"
alt="Product photo"
/>For a single fixed-size image on high-density screens, ?img-width=400&img-dpr=2 does the job with less markup. It serves an 800-pixel image that you display at 400 CSS pixels.
We don't publish before-and-after numbers here, because savings depend on your source files. You can measure them in two requests. Compare the byte count of the original with a resized copy of the same CID (commands from the documented URL format, not run here):
# Original bytes
curl -s -o original -w '%{size_download} bytes\n' "https://public.aiozpin.network/ipfs/<CID>"
# Same CID at 400 px wide, quality 50, WebP for browsers that accept it
curl -s -o small -H 'Accept: image/webp' -w '%{size_download} bytes\n' \
"https://public.aiozpin.network/ipfs/<CID>?img-width=400&img-quality=50&img-format=webp"Run it on a few typical images, a large photo, a PNG screenshot, and a GIF, to see where transforms pay off. Keep the public gateway's limits in mind while testing: 15 requests per minute per CID and 200 per minute per IP.
img-onerror=redirect tells the gateway to send the original file if optimization fails, instead of an error. On a production <img> tag, that's the difference between a broken-image icon and a full-size image that still loads. Set it on anything user-facing where an odd source file could otherwise break your layout.
cover plus img-gravity gives every card the same shape, whatever the source.It isn't a full image pipeline. The docs list no SVG support, no video thumbnails, and no subject detection beyond img-gravity=auto. For those, you still need a separate service.
Resizing runs on our gateways, for content pinned on AIOZ Pin. The public gateway needs no authentication, so URLs drop straight into HTML or CSS, which can't send headers. It's meant for testing, though. For production traffic, a premium gateway has no predefined rate limit and serves from 200+ edge caching locations. Free plan users get a limited premium gateway that serves single files such as images, which covers this use.
From Node.js, the SDK wraps the same options in optimizeImage and returns the image bytes. This is the README example for version 1.0.1, lightly trimmed (not run here):
import { writeFileSync } from 'fs'
const result = await client.optimizeImage({
cid: 'YOUR CID',
gatewayProviderUrl: 'GATEWAY URL',
config: { imgWidth: 800, imgQuality: 75, imgFit: 'cover', imgGravity: '0.5x0.5' },
axiosConfig: { responseType: 'arraybuffer' }
})
writeFileSync('optimized-image.jpg', Buffer.from(result))There's no separate line item for transforms on the payment page. Storage is $20 per TB per month and bandwidth $20 per TB, so a smaller image also costs you less to serve.
Next step: read the AIOZ Pin image optimization docs and try a parameter on one of your pinned images.
How do I resize an image using URL parameters on AIOZ Pin? Add img-width, img-height, and optionally img-fit to the gateway URL, for example https://public.aiozpin.network/ipfs/<CID>?img-width=400.
Do I need an API key to resize images? No. The docs say public gateway image optimization needs no authentication, so the URL works directly in an <img> tag.
Which image formats are supported? BMP, GIF, JPG/JPEG, PNG, and WebP. There's no SVG support in the list.
Can AIOZ Pin convert images to WebP? Yes. Add img-format=webp and the gateway serves WebP to browsers that support it, falling back to standard formats otherwise.
Does resizing cost extra? The payment page lists storage, bandwidth, and pinned-file fees, with no separate charge for transforms. Resized images are served as normal gateway bandwidth.
What happens if a transform fails? By default you get an error. Add img-onerror=redirect and the gateway serves the original image instead.

ERC-1155 metadata on IPFS breaks when filenames ignore the {id} rule. Here is the exact 64-character format, a working folder layout, and the per-token option.

AIOZ Pin rate limits in one place: 180 requests per minute for the API, 15 per CID on the public gateway, and no predefined limit on premium gateways.

IPFS pin stuck on Pinning? Here is what Pinning, Pinned, and Failed mean on AIOZ Pin, why big directories can sit there, and how to read a pin's real state.

Two identical files, three IPFS tools, three different CIDs. Here is why that happened for years, and how IPIP-0499 made content addressing deterministic.

AIOZ Pin MCP server setup has two paths: llms.txt lets a super intelligence assistant read the API, the MCP server lets it call 11 tools. Here is each one.

AIOZ Pin bills three flat rates against a token wallet, with no tiers to pick between. Here is what storage, bandwidth and pinned files cost, with examples.