Image Optimizations
Optimize images on the IPFS gateway
Our IPFS gateway provides a list of options that you can use to optimize images stored on the IPFS network. Currently, we support optimization for the formats bmp, gif, jpg, jpeg, png and webp. These options can significantly improve load time and experience when viewing image content.
Usage
To use image optimizations on images that you've uploaded, simply add the queries mentioned in the reference via query parameters. Your full url might look something like this:
https://premium.aiozpin.network/ipfs/bafkreiefnp4dflv35vsqzrnp25woubdbylgesttpanq6dfkctbhgo3lvy4?img-width=300&img-height=600&img-fit=coverReference
At least one option must be specified for the optimization feature to activate.
img-width unsigned integer
Specifies the maximum width in pixels of the image (range 1 to None). Exact effect depends on the selected img-fit.
Default: 0 (Source). If omitted but img-height is set, defaults to img-height.
img-height unsigned integer
Specifies the maximum height in pixels of the image (range 1 to None). Exact effect depends on the selected img-fit.
Default: 0 (Source). If omitted but img-width is set, defaults to img-width.
img-dpr unsigned integer
Specifies the Device Pixel Ratio. This multiplies the width and height to support high-DPI displays (range 1 to 3).
Default: 1.
img-fit string
Affects interpretation of width and height. All resizing modes attempts to preserve aspect ratio.
Default: scale-down.
Available fit modes:
img-fit=scale-downShrinks the image to fit, but doesn't enlarge it.img-fit=containScales the image up or down to fit within the dimensions.img-fit=coverFills the dimensions completely; may crop the image.img-fit=cropShrinks and crops as needed to fit; behaves likescale-downfor small images andcoverfor larger ones.img-fit=padFits the image within dimensions with padding (usually white); use CSSobject-fit: containfor transparent backgrounds.
img-gravity string
Defines the focal point when cropping with img-fit=cover.
Default: center.
Available values:
img-gravity=autoAutomatically detects the main focus area.img-gravity=sideCan betop,bottom,leftorrightimg-gravity=XxYCoordinates between0.0and1.0; e.g.,0.5x0.5is center,0x1is bottom-left
img-quality unsigned integer
Sets the image quality for JPEG and WebP formats (range 1-100).
Default: 80. Recommended values: 50 (small files), 90 (high quality).
img-format string
If value is webp then allows serving Webp image for compatible browsers. Falls back to standard formats if unspecified.
img-anim string
Converts animated images (like GIFs) to still images to reduce file size and prevent flashing effects. Accepted values include true and false.
img-sharpen unsigned integer
Specifies the strength of the sharpening filter. Default: 0 (no sharpening). Accepted values range from 0-10.
img-onerror string
Determines behavior on fatal errors when optimizing image. Specify img-onerror=redirect to redirect to original image URL.
img-metadata string
Controls how much invisible metadata (EXIF) is retained
Default: copyright.
Available values:
img-metadata=keepRetains all metadata if possible, including GPS.img-metadata=copyrightKeeps only copyright information.img-metadata=noneStrips all metadata.