
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. Updated Oct 29, 2026: merged our separate post Image Optimization on AIOZ Pin: Smarter Image Delivery from IPFS into this guide, adding a presets rollout section and two FAQs.
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.
The older way to handle image sizes is to render every size at build time and pin each one. It works, but it fixes your sizes in advance, so a new layout means another render, another upload, and a new set of CIDs to swap into your pages.
With gateway parameters, you pin one original and describe each size in its URL. The difference also shows up in your pinned-file count. Keeping an original plus three rendered sizes for 10,000 product photos is 40,000 pinned files, which uses the entire free allowance on the payment page. One original per photo keeps you at 10,000, and you store one file per photo instead of four.
Most sites only need a handful of sizes. Here's a starting set you can adapt, built only from documented parameters. The avatar preset asks for 96 pixels at img-dpr=2, so the gateway serves 192 pixels for sharp display on high-density screens:
| Preset | Query string | Where you'd use it |
|---|---|---|
| Card | ?img-width=400&img-height=300&img-fit=cover&img-quality=80 | Product grids and NFT gallery tiles |
| Hero | ?img-width=1600&img-format=webp | Full-width banners |
| Avatar | ?img-width=96&img-height=96&img-fit=cover&img-gravity=auto&img-dpr=2 | Profile pictures on high-density screens |
| Share card | ?img-width=1200&img-height=630&img-fit=cover | Link previews |
To roll the presets out across a site, work through these steps in order:
scale-down mode never enlarges an image, so the source file sets the ceiling for every preset.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.
Do I need to pin a separate copy of an image for each size? No. You pin one original, and each URL with different img- parameters returns a different size from it. Extra pre-rendered copies only add pinned files and storage to your bill.
Will a resized GIF stay animated? The API reference says img-anim controls whether GIF animation is preserved and defaults to false, so add img-anim=true when you want the animation kept. The gateway page describes the same option as turning animations into stills, so test one GIF before you rely on either reading.

A multiaddr is a network address that names every protocol it uses, like /ip4/.../tcp/4001/p2p/ and a peer ID. Learn to read one and how IPFS peer IDs work.

IPFS bootstrap nodes are the first peers a new node dials to join the Amino DHT. See how Kubo uses them, who runs them after Shipyard, and how to edit the list.

The ipfs.io gateway now returns HTTP 429 to scripts and servers and sends browsers to inbrowser.link. See who runs the public IPFS services and what to change.

An IPFS glossary of 115 terms from A to Z: CIDs, Bitswap, the DHT, IPNS, gateways and pinning, each defined in plain words and linked to a deeper guide.

IPFS Provide Sweep is Kubo's provider that batches CIDs by DHT region, not one lookup each. See how it works, when it became default, and how to check it.

An IPFS dedicated gateway on AIOZ Pin is called a premium gateway. See what the free plan limits, what a paid plan adds, and what happens at zero balance.