How to determine if a lossless image was a jpeg?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
Marsu42
Posts: 75
Joined: 2014-06-12T03:17:45-07:00
Authentication code: 6789
Location: Berlin

How to determine if a lossless image was a jpeg?

Post by Marsu42 » 2019-02-12T05:16:45-07:00

This isn't im-specific, but I hope this can be done with some im magic or at least some folks can help otherwise:

I'm processing lossless images (png, tif, lossless webp) and am looking for a way to determine if it actually was a lossless format (i.e. jpeg most of the time) once. Visually, this is mostly obvious by looking for jpeg blocky artifacts or wavelet smoothing like in jpeg2k. But how to autmate it?

One idea is to compress the image as jpeg-lossy and then compare some metrics => if it was jpeg already once before, metrics should be very close?

Thanks for any hints!

snibgo
Posts: 11930
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to determine if a lossless image was a jpeg?

Post by snibgo » 2019-02-12T05:27:04-07:00

I think looking for patterns in blocks might work. See my reply at https://www.imagemagick.org/discourse-s ... 5&p=157734
snibgo's IM pages: im.snibgo.com

User avatar
Marsu42
Posts: 75
Joined: 2014-06-12T03:17:45-07:00
Authentication code: 6789
Location: Berlin

Re: How to determine if a lossless image was a jpeg?

Post by Marsu42 » 2019-02-18T02:00:15-07:00

snibgo wrote:
2019-02-12T05:27:04-07:00
I think looking for patterns in blocks might work. See my reply at https://www.imagemagick.org/discourse-s ... 5&p=157734
Thanks, so this thread is a dupe, I'll continue discussing in the other one.

Post Reply