Resizing JPEG without losing Quality

后端 未结 3 1023
暗喜
暗喜 2021-01-29 03:10

I am trying to work on a small webbased Image editor with .NET . I am having issue with JPEG image resize.As I understand there is no way to manipulate JPEG without loosing some

3条回答
  •  执笔经年
    2021-01-29 04:10

    Yes, it will lose quality as well. The difficulty of resizing JPEG is due to the compression (aka encoding) algorithm itself, so it is irrelevant what image format is the source, because to encode the image you have to decode it to a raw format (bitmap, that is) first.

    Also, it's good to remember, that if the image you're encoding has been a JPEG before, encoder will have harder time encoding it again after resizing. JPEG divides image into 8x8 pixel blocks to perform the encoding, and resizing moves the borders of these blocks. This is important note, because with higher compression ratios the borders between blocks become sharper -- and JPEG is especially bad in encoding irregular sharp edges in image (I'm skipping all the internal details, they're not important for now, comment if you'd like to know them anyway). This effect is not important for typical photo compression ratios, though.

    Essentially: if you encode image as JPEG, you have to encode it at least once (obvious, isn't it? ;) ). And JPEG (i.e. lossy) encoding equals losing quality.

提交回复
热议问题