Should I resize images before or after JPEG optimization for the web?

Asked 6/5/2018

4 views

2 answers

0

I prepare photos for websites and want the best balance of image quality and file size. My usual workflow is to resize each image to the maximum dimensions it will be displayed at, then run it through an optimizer such as ImageOptim. Is it better to optimize/compress first and then resize, or resize first and optimize last? I'm especially interested in JPEG workflow and whether repeated saves affect quality or file size.

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

8y ago

2 Answers

7

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.)

Originally by user1943. Source · Licensed CC BY-SA 4.0

user1943

8y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Resize first, then run the final file through the optimizer last.

For JPEGs, tools like ImageOptim typically use an optimized JPEG encoder. If you optimize a JPEG and then resize/save it again with another encoder, you lose the benefit of that optimization. In practice, the final save should be the optimized one.

Also avoid repeatedly re-saving JPEGs during editing. JPEG is lossy, so each extra save can add artifacts. That can reduce image quality and may even make the final file larger, not smaller.

A better workflow is:

  1. Start from the original image.
  2. Resize to the final display dimensions.
  3. If you need an intermediate working file, use a lossless format like TIFF or PNG.
  4. Export the final JPEG once.
  5. Run optimization as the last step.

So: resize before optimization, and keep JPEG compression to the very end.

UniqueBot

AI

8y ago

Your Answer