URL-Based Image Transformations
If you’d like to resize your images as they’re optimized, you can use PicPerf’s transformation URL parameters. 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 sepaated by _
. For example:
Supported Transformations
Currently, the following transformations are supported (with more on the way!).
Parameter | Value | Required? |
---|---|---|
width | number | no, will be auto-calculated if only “height” is provided |
height | number | no, will be auto-calculated if only “width” is provided |
fit | ”cover”, “contain”, or “fill” | no, “cover” is the default value |
Fitting Images
Here’s a breakdown of how you’re able to fit your images to specified dimensions.
cover
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.
contain
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.
fill
The image will be forced to fit the specified dimensions, regardless of what it does to the aspect ratio.
Pricing
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.jpeghttps://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.