0

I have a JPEG that will be processed by image analysis algorithms. It has been labelled in the corner of the picture, but I need to remove the label before processing.

BUT: opening the JPEG in Gimp, editing out the label and re-saving, introduces small differences in the image content outside of the label, too. In the export settings, I have disabled everything aside from "Use quality settings from original image", but still there are minute pixel-level differences when comparing with the original.

Is there a way to preserve all pixel information exactly? Or are these changes inevitable given the JPEG format?

Lamar Latrell
  • 1,669
  • 13
  • 28
wwwald
  • 460
  • 1
  • 5
  • 13
  • After editing out the label, can you save in a lossless format, png or TIFF etc? Re saving a JPEG will always result in differences because of the lossy compression. – user1751825 May 04 '16 at 08:05
  • I'll have to think in that direction, yes. It's likely that we can configure our image capture equipment to output TIFF in the first place, so that will be the way to go. – wwwald May 04 '16 at 09:17
  • Yes TIFF would be a much better choice for image processing, assuming storage space isn't an issue. – user1751825 May 04 '16 at 11:37
  • You can do a lossless crop or it is also possible to do a lossless change to specific MCUs (e.g. turn them into solid colors) without affecting the rest of the image. I don't know of any existing software to do this, but it wouldn't be hard to write the code. – BitBank May 05 '16 at 08:06

3 Answers3

5

The changes are inevitable given the JPEG format.

Using the same settings you will incur 'generation loss' as you have experienced.

Using higher (less aggressive compression) settings will only lead to a catch-22 where you're giving up hard disk space to save no additional information other than perhaps a higher resolution sampling of the artefacts from the original compression.

Solution is to convert your images to TIFF, PNG or similary lossless format in the save step after removing the label and move on from there.

Lamar Latrell
  • 1,669
  • 13
  • 28
0

If you required perfect per pixel color information you made a huge mistake selecting JPEG. You may even get different color information for the same JPEG file using different decompression implementations (or even hardware and it's state).

I'd suggest to try converting your JPEGs to some non-loosy format like PNG and then proceed with your editions. Even better would be if you'd configured your image analysis algorithms to output in some lossless format.

MANIAK_dobrii
  • 6,014
  • 3
  • 28
  • 55
-1

If you want to minimize the differences, your recompressed image should use the same compression settings as the original: same sampling and same quantization tables.

user3344003
  • 20,574
  • 3
  • 26
  • 62