Skip to content

URL-Based Image Transformations

If you’d like to resize or convert your images as they’re optimized, PicPerf’s transformation feature lets you transform images without quality loss. This helps optimize images for web performance while maintaining visual quality. To do so, insert /t/YOUR-PARAMS immediately after https://picperf.io and before your image URL. The parameters themselves must be a comma-separated list of values, where the name and value of the parameter is separated by _. For example:

https://picperf.io/t/width_400,height_400,fit_cover/https://yoursite.com/pic.jpeg

You can also force a specific output format:

https://picperf.io/t/width_400,height_400,fit_cover,format_jpeg/https://yoursite.com/pic.jpeg

Currently, the following transformations are supported (with more on the way!).

ParameterValueRequired?
widthnumberno, will be auto-calculated if only “height” is provided
heightnumberno, will be auto-calculated if only “width” is provided
fit”cover”, “contain”, or “fill”no, “cover” is the default value
format”jpeg”, “jpg”, “png”, “avif”, or “webp”no, the original format is used by default

Here’s a breakdown of how you’re able to fit your images to specified dimensions.

cropping examples

This the default value. During cropping, the image’s aspect ratio will be preserved, but may be clipped in order to fit the specified dimensions.

None of the image will be clipped. It’ll be made to fully fit within the specified dimensions, which may mean that the image does not meet one dimension or the other.

The image will be forced to fit the specified dimensions, regardless of what it does to the aspect ratio.

Use the format parameter when you need the image returned in a specific format, regardless of the original file type. This is useful when you need consistent output across mixed sources — for example, converting PNGs and JPEGs alike to WebP for a modern browser audience.

Supported values:

  • jpeg or jpg
  • png
  • avif
  • webp

format can be used on its own or combined with resize parameters:

https://picperf.io/t/format_webp/https://yoursite.com/pic.png
https://picperf.io/t/width_800,format_avif/https://yoursite.com/pic.jpeg

When format is specified, PicPerf returns the image in that format instead of automatically choosing the smallest optimized format.

Image transformations are included in your plan, but note that every different transformation applied to the same image URL will count as a unique optimized image for your plan.

For example, each of these URLs will be treated as 500 distinct images optimized, despite the same source URL being used:

https://picperf.io/t/width_1/https://yoursite.com/pic.jpeg
https://picperf.io/t/width_2/https://yoursite.com/pic.jpeg
https://picperf.io/t/width_3/https://yoursite.com/pic.jpeg

.........
https://picperf.io/t/width_499/https://yoursite.com/pic.jpeg https://picperf.io/t/width_500/https://yoursite.com/pic.jpeg

Keep in mind that there is no limit to the number of times a transformed image can be served. After transformation has occured, it could be served from one to one billion times with no impact on cost.