<p>All common image file formats are compressed, even lossless formats like RAW, TIFF or PNG use compression!</p>

<p>To reduce file size of you images you should choose a lossy format (avoid TIFF Baseline or BMP), and accept some degree of information loss to reduce the file size. You usually set this quality to file size ratio in percentages (for the web). Craft's default quality ratio applied on transforms, <a href="http://buildwithcraft.com/docs/config-settings#defaultImageQuality" rel="nofollow noreferrer"><code>defaultImageQuality</code></a>, is set to 75%, but you can always set it to your needs <a href="http://buildwithcraft.com/docs/image-transforms#defining-transforms-from-the-control-panel" rel="nofollow noreferrer">from the Control Panel</a> or <a href="http://buildwithcraft.com/docs/image-transforms#defining-transforms-in-your-templates" rel="nofollow noreferrer">in your templates</a>.</p>

<p>There's a nice <a href="http://upload.wikimedia.org/wikipedia/commons/c/ce/Quality_comparison_jpg_vs_saveforweb.jpg" rel="nofollow noreferrer">chart on Wikimedia</a>, illustrating the relative quality of quality settings for JPG formats.</p>

<p>Additionally I'd recommend you to have a look at this <a href="https://craftcms.stackexchange.com/a/1446/125">other question</a> about transformation performance with image libraries supported by Craft.</p>

CC BY-SA 3.0
2014-07-31T14:18:13.687Z
I'm fully aware of how to optimize and export images for use on the web. I used to use Debabblizer back in the day after all. I'm looking for something along the lines of TinyPNG or jpegoptim compressing the image even further after it's transformed. My source files are all compressed using ImageOptim or TinyPNG on the desktop prior to uploading but the image transforms receive no further optimization and are flagged for it on web site performance tests.
Stuart McCoy
CC BY-SA 3.0
2014-07-31T08:05:58.290Z
2014-07-31T08:05:58.290Z
2017-04-13T12:51:00.200Z
carlcs
<p>Yes, you can do this if you use the Imager plugin. Here's how: <a href="https://nystudio107.com/blog/creating-optimized-images-in-craft-cms" rel="nofollow noreferrer">Creating Optimized Images in Craft CMS</a></p>

CC BY-SA 3.0
2016-12-04T17:29:25.020Z
2016-12-04T17:29:25.020Z
andrew.welch
<p>Compress?  No.  But you can set a <a href="http://buildwithcraft.com/docs/config-settings#defaultImageQuality" rel="nofollow">default image quality</a> for transformed images with the <code>defaultImageQuality</code> config setting that can be overridden on a per-transform basis from the control panel.</p>

<p>That quality value gets passed onto the respective <a href="http://php.net/manual/en/book.image.php" rel="nofollow">GD</a> or <a href="http://php.net/manual/en/book.imagick.php" rel="nofollow">Imagick</a> driver when generating the image and will affect image size and quality.</p>

CC BY-SA 3.0
2015-07-18T18:56:17.070Z
Yeh it would be great to have Craft run something like jpegoptim (say if it's installed on the server) right after saving the transform. Really shaves a bit off with no degradation of quality.
RitterKnight
CC BY-SA 3.0
2014-07-31T14:15:34.597Z
I'm trying to avoid degrading image quality as much as possible. I'm already compressing the source images but all web speed tests flag the transformed images as candidates for compression. Would be nice to have this ability given the recent focus on site performance. Perhaps a feature request is in order? Find a way to have image transforms compress images using TinyPNG, jpegoptim, gifsicle, etc.
Stuart McCoy
CC BY-SA 3.0
2014-07-31T18:21:56.510Z
Hrm... maybe.  Feels like that might be falling into plugin territory, though.
Brad Bell
CC BY-SA 3.0
2014-08-01T14:31:44.467Z
This has been on my mind too as I'd love to convert images to .webp too
Niall Thompson
CC BY-SA 3.0
2014-07-31T04:11:44.490Z
2014-07-31T04:11:44.490Z
Brad Bell
<p>Double check that the page speed reports are not flagging the images because you're rendering them at a smaller size than their natural pixel size. I believe it give a very similar message if you do.</p>

<p>For example; check you're not using a 1000px wide image and displaying it at only 700px. You'll want to look into the Picture element if that's happening and you're not already using it. In fact you'd want to use the picture element for different pixel densities too.</p>

<p><a href="https://developer.mozilla.org/en/docs/Web/HTML/Element/picture" rel="nofollow noreferrer">https://developer.mozilla.org/en/docs/Web/HTML/Element/picture</a></p>

CC BY-SA 3.0
2016-12-05T09:28:57.503Z
2016-12-05T09:28:57.503Z
Matt Wilcox
<p>I'm using image transforms to create 1x versions of hdpi 2x images but one area I get slammed on web page performance is loading these images. Is it possible to compress them and if so, how?</p>

<image-transforms>
Is it possible to compress image transforms?
# Is it possible to compress image transforms?

(Asked by: username_0 on 2014-07-31)

I'm using image transforms to create 1x versions of hdpi 2x images but one area I get slammed on web page performance is loading these images. Is it possible to compress them and if so, how?

**Tags:** image-transforms


---

## 4 answers

### Answer by username_1 on 2014-07-31. Score: 4

All common image file formats are compressed, even lossless formats like RAW, TIFF or PNG use compression!

To reduce file size of you images you should choose a lossy format (avoid TIFF Baseline or BMP), and accept some degree of information loss to reduce the file size. You usually set this quality to file size ratio in percentages (for the web). Craft's default quality ratio applied on transforms, [`defaultImageQuality`](http://buildwithcraft.com/docs/config-settings#defaultImageQuality), is set to 75%, but you can always set it to your needs [from the Control Panel](http://buildwithcraft.com/docs/image-transforms#defining-transforms-from-the-control-panel) or [in your templates](http://buildwithcraft.com/docs/image-transforms#defining-transforms-in-your-templates).

There's a nice [chart on Wikimedia](http://upload.wikimedia.org/wikipedia/commons/c/ce/Quality_comparison_jpg_vs_saveforweb.jpg), illustrating the relative quality of quality settings for JPG formats.

Additionally I'd recommend you to have a look at this [other question](https://craftcms.stackexchange.com/a/1446/125) about transformation performance with image libraries supported by Craft.

> **Comments:**
> **username_0**: I'm fully aware of how to optimize and export images for use on the web. I used to use Debabblizer back in the day after all. I'm looking for something along the lines of TinyPNG or jpegoptim compressing the image even further after it's transformed. My source files are all compressed using ImageOptim or TinyPNG on the desktop prior to uploading but the image transforms receive no further optimization and are flagged for it on web site performance tests.  

---

### Answer by username_2 on 2016-12-04. Score: 3

Yes, you can do this if you use the Imager plugin. Here's how: [Creating Optimized Images in Craft CMS](https://nystudio107.com/blog/creating-optimized-images-in-craft-cms)


---

### Answer by username_3 on 2014-07-31. Score: 2

Compress? No. But you can set a [default image quality](http://buildwithcraft.com/docs/config-settings#defaultImageQuality) for transformed images with the `defaultImageQuality` config setting that can be overridden on a per-transform basis from the control panel.

That quality value gets passed onto the respective [GD](http://php.net/manual/en/book.image.php) or [Imagick](http://php.net/manual/en/book.imagick.php) driver when generating the image and will affect image size and quality.

> **Comments:**
> **username_0**: I'm trying to avoid degrading image quality as much as possible. I'm already compressing the source images but all web speed tests flag the transformed images as candidates for compression. Would be nice to have this ability given the recent focus on site performance. Perhaps a feature request is in order? Find a way to have image transforms compress images using TinyPNG, jpegoptim, gifsicle, etc.  
> **username_3**: Hrm... maybe.  Feels like that might be falling into plugin territory, though.  
> **username_5**: This has been on my mind too as I'd love to convert images to .webp too  
> **username_4**: Yeh it would be great to have Craft run something like jpegoptim (say if it's installed on the server) right after saving the transform. Really shaves a bit off with no degradation of quality.  

---

### Answer by username_6 on 2016-12-05. Score: 0

Double check that the page speed reports are not flagging the images because you're rendering them at a smaller size than their natural pixel size. I believe it give a very similar message if you do.

For example; check you're not using a 1000px wide image and displaying it at only 700px. You'll want to look into the Picture element if that's happening and you're not already using it. In fact you'd want to use the picture element for different pixel densities too.

<https://developer.mozilla.org/en/docs/Web/HTML/Element/picture>


---

