3

I am a software dev who appreciates stunning imagry in sites I build, but am also very conscious of page size. My workflow has me adjusting image sizes to the maximum resolution they will be displayed to the user. I also use ImageOptim a tool that applies a few compression methods to my images. I am wondering what is better though, to compress the images before I resize them, or after?

8

The "ImageOptim" tool pulls together a bunch of other things, and in the case of JPEG files, the relevant thing is the MozJPEG optimizing encoder. If you use this encoder and then resize and save with a different encoder, you will lose the benefit. Saving with the optimizer needs to be the last step.

Also worth noting: if you're starting with a JPEG and then saving as JPEG using a non-optimizing encoder and then saving again with MozJPEG, you are probably introducing artifacts. Those won't just reduce image quality — they may actually make the final image size worse. So, use a lossless format like TIFF or PNG as your intermediate. (PNG will lose metadata, but since you're throwing that away to get the smallest possible images anyway, that's fine.)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.