Image Processing
Image Processing
Image processing is to resize and convert images. The process of processing, caching and responding is taken place on EdgeOne servers. Your own origin only needs to store the original images, thus reducing image management costs on your side. EdgeOne can also compress images to improve page load speed without sacrificing visual impact.
Supported Image Processing Capability
Resize
Capability | Parameter Name | Parameter Value(type/pixel) | Description |
Resize | eo-img.resize | w/<Width> ,for example:w/100 | Specify width, height adaptive |
| | h/<Height> ,for example:h/100 | Specify height, width adaptive |
| | w/<Width>/h/<Height> ,for example:w/100/h/100 | Specify width and height |
| | l/<Long> ,for example:l/100 | Specify long side, short side adaptive |
| | s/<Short> ,for example:s/100 | Specify short side, long side adaptive |
Format Conversion
Support converting the original image to the specified format by carrying the specified parameter
Capability | Parameter Name | Supported Input Formats | Supported Output Formats |
Format Conversion | eo-img.format | Static image:jpg、png、bmp、jp2、jxr、gif、webp、avif、heif | All static:jpg、png、bmp、jp2、jxr、gif、heif、webp、avif |
| | Dynamic image:gif、webp、avif、heif | Static:jpg、png、bmp、jp2、jxr(take the first frame of gif animation as a single static image)
Dynamic:gif、webp、avif、heif |
Limitations
The original image size for processing should not exceed 32MB.
The width and height of the input original image should not exceed 30,000 pixels, and the total pixels should not exceed 250 million pixels; for dynamic images, the width x height x frame count of the original image should not exceed 250 million pixels.
The input gif format animation frame count should not exceed 300 frames.
The width and height settings of the output image should not exceed 9999 pixels.
Note
Any of the following situations may cause the image processing to fail and return the original image:
1. If any parameter of the original image and the result image for image processing exceeds the above limits, we will not be able to process the image and can only respond with the original image.
2. If incorrect request parameters are entered, the image will not be processed and will be returned directly as the original image, such as the following situations:
Duplicate input parameters:
eo-img.resize=w/100&eo-img.resize=w/200
, which will be considered as illegal parameter passing;pelling error: any format error or spelling error parameter, such as
eo-img.resize=w=100
, will be considered as illegal parameter passing;Resize parameter error: the parameters
w/
(width) and h/
(height) should not be mixed with s/
(short side) and l/
(long side). For example, w/300/s/200
is illegal parameter passing, and the image will remain unchanged.3. If the image scaling function is turned off within the console, all eo-img related parameters will be treated as normal query strings and will not trigger the image processing function.
4. If other exceptions occur that prevent normal image processing, we will prioritize providing the original image, and in subsequent requests, we will automatically try to reprocess the image.
Pricing
This feature is billed based on the number of image resizing requests. For more information, see VAU Fee (Pay-as-You-Go).
Note
This feature is in the free trial period now.
Directions
You can add image processing parameters to the client request URL to resize images.
If you don’t want to change the original client request URL, please try edge functions. See Converting Images with Edge Functions.
Adding Image Processing Parameters to the Client Request URL
You can add image processing parameters to the client request URL to resize images.
1. Log in to the EdgeOne console. click on the site list in the left menu bar, click on the site to be configured in the site list, and enter the site details page.
2. On the site details page, click Site Acceleration > Media Processing on the left sidebar.
3. On the page that appears, toggle Image Resize on.
4. After enabled, you only need to pass the image scaling demand by concatenating the eo-img related parameter to the Request URL in the Client requests. EdgeOne will automatically complete the image processing based on the image processing parameter in the Request URL. For example:
https://www.example.com/foo.png?eo-img.resize=w/100
。Image Processing Example
In the following examples, the original image is 500 × 280 pixels in resolution and 500 KB in size.
1. Resize the image width to 200 pixels and scale the height automatically:
Request URL:
http://www.example.com/foo.png?eo-img.resize=w/200
2. Resize the image height to 200 pixels and scale the width automatically:
Request URL:
http://www.example.com/foo.png?eo-img.resize=h/200
3. To resize the image width to 300 pixels and the height to 200 pixels:
Request URL:
http://www.example.com/foo.png?eo-img.resize=w/300/h/200
Important
If both the width and height are specified, the aspect ratio of the original image may not be retained.
4. Resize the long side to 400 pixels and scale the short side automatically:
Request URL:
http://www.example.com/foo.png?eo-img.resize=l/400
5. Resize the short side to 200 pixels and scale the long side automatically:
Request URL:
http://www.example.com/foo.png?eo-img.resize=s/200
6. Convert the image format to WebP:
Request URL:
http://www.example.com/foo.png?eo-img.format=webp
Output image format: WebP
7. Resize the width to 200 pixels, scale the height automatically, and convert the format to WebP.
Request URL:
http://www.example.com/foo.png?eo-img.resize=w/200&eo-img.format=webp