Take the 2-minute tour ×

I'm trying to cut down on a picture size and I was wondering:

Is it better to compress the original image first, then re-size it or should I re-size it and then compress the smaller version of it?

Is there any difference?

I'm working with C#.

share|improve this question
A bit of speculation, but I feel if you try to resize something after compressing it you could result in a loss in quality. –  Kevin DiTraglia Aug 17 '12 at 20:29
If you are resizing it then surely you need to compress it once it has been re-sized in order to save it? –  ColinE Aug 17 '12 at 20:31
add comment

3 Answers

up vote 1 down vote accepted

Compression causes loss of quality and details in your image, so as a general rule it should always be the last step after applying any modifications.

share|improve this answer
thanks! i can only accept your answer in 10 mins tho :P –  Testifier Aug 17 '12 at 20:33
... Except that resizing also causes loss of quality/detail. What's more important in requiring compression to be last is that, while compressed, the image is effectively immutable; you have to uncompress it to change it, and then recompress it (which hopefully will result in the same lossy simplifications that are performed prior to actual compression not having an effect). –  KeithS Aug 17 '12 at 20:42
add comment

No matter what you do, compression always happens last. This is because compression is inherent in the saving of the image, and it is impractical to try to work with the image in its compressed form; you virtually always uncompress it in order to work with the image itself, and not simply pass the file around.

So, if you compress, then resize, the sequence of steps is compress->uncompress->resize->compress. If you are using a "lossless" compressed image format, like PNG, you're wasting time on the initial two steps because nothing will change, and you might as well just resize, then compress.

Where this might have a difference is when using "lossy" compression algorithms like JPEG. "Lossy" formats use similar algorithms to actually compress the data of the image as lossless ones, but they incorporate an additional step of simplification; the image is processed to produce (hopefully) subtle changes in the actual pixels, which allows the entire image to be digested more efficiently by the compression algorithm (usually, blocks of pixels are made more similar, so that the entire block can be represented by one or two bytes of "hash" which is then cross-referenced in a metadata dictionary and the hash substituted for the block where it occurs). This simplification is one-way; you can't "un-simplify" the processed image to get the original one back, and so the sequence of steps for a compress and then resize is simplify->compress->uncompress->resize->simplify->compress. The simplification step happens twice, affecting the image before and after resizing. Whether this actually results in a smaller file size depends on the exact image and the quality settings used to apply the simplification filter.

share|improve this answer
add comment

if you resize image before compress it is better for quality of image but bad for streaming because or data size

if you compress and resize it is better for streaming (small size) but quality will be limited at original size

share|improve this answer
add comment

Your Answer


