Filestack now offers a standalone task specifically for compression. It utilizes mozjpeg to offer improved compression for jpgs over the algorithm used for output=compress:true. It will not attempt to re-compress a previously compressed image. Compress will only work with png and jpg files. If any other format is passed in, it will return an unchanged image. For the best results, compress should be the last task in your transformation chain.
The root task cannot be abbreviated
compresswithout any options and the default settings will be used.
Can be abbreviated as
metadata:truein order to prevent the metadata from being removed.
The original image is 5.9mb and has dimensions of 4740x3160. By running it through the compress task, we can reduce its size.
Image using all the default settings
This action reduces the size of the file by 4%, but depending on the image, the size reduction can be far greater.
If you are standardizing your images by resizing them to a specific size, you can additionally add in the compress task to further optimize them.Image resized to a width of 1000 using
This reduced the file size to 318kb. However, we can achieve a greater reduction in size by combining the resize with the compression task. It should be the last task passed in your URL, otherwise the image will be compressed before it gets resized.Image resized to a width of 1000 and then compressed using
The end result is an image that is 276.6kb. Which is a 13% reduction in file size from the 318kb image.
If we decide we want to maintain the metadata:Image resized and compressed while keeping the file metadata
Then the transformed image is 296.4kb
Someone from our team will get back to you shortly.