When working with JPEG image properties (resolution, sampling, etc.) and you export the final product are you ALWAYS double dipping into ‘jpegification’?
From my understanding when you load a JPEG image into an image manipulation tool (GIMP, Photoshop, ImageMagick, etc.) it goes like so:
- Import JPEG
- Decode JPEG into easier workable format (Bitmap)
- Manipulate the pixels
- Export back into JPEG (REDOING JPEG QUANTIZATION AGAIN, even if you copy the original JPEG parameters it’s a double dip)
Am I correct in this?
Thanks!
2
Answers
I think it depends on what you do after reading the image… but I think you can check for yourself for any particular operation and whether it has re-quantised by using this function in ImageMagick
which calculates the checksum (or
signature
as IM calls it) of the pixels – disregarding the header information.So, if I create a file of random noise, like this
and get the checksum of the data, like this
I can then use
jhead
to change the comment in the header, like thisand yet the checksum remains unchanged so I would say
jhead
has NOT re-quantised the data.I guess my point is that your statement that images are ALWAYS re-quantised is not 100% accurate and it depends on what you actually do to the image, and further, that I am showing a way you can readily check for yourself whether any processing has actually caused requantisation. HTH !!!
Any areas of the image that have changed would have to be quantized again anyway.
In theory, an application could keep the quantized values lying around then use them again. However,
That would require 3 times as much memory. The quantized values require 16 bits to store (+8 bits for the pixel value).
If you changed the sampling or quantization tables, the quantized values would have to be recalculated.
There would be very few cases where it would make sense to hang on to the quantized DCT values.