Question

Writing JPEG with defined compression

  • 11 January 2016
  • 5 replies
  • 11 views

Badge

I am going to use FME to run finalisation on ortophoto projects. Two of the products require JPEG to be part of final delivery. One require compression Q= 10, the other Q= 20.

Producing the files is fast enough, and images look good when viewing in IrfanView. But when reading the header-info in "ISRU Display Header", I realise that the actual compression deviates from the set compression value in the Writer. I cannot deliver this to client, as they will simply not accept non-compliance of the specs given (when they say Q= 10, they mean it).

Does anyone have experience in similar issues, and able to give me a hand?


5 replies

Badge +14

I've just tested this and setting compression to 10 in FME yields a value of 91 in IrfanView...

20 in FME = 82 in IV

85 in FME = 24 in IV

So, I think I've replicated what you are seeing and it is a little odd. Does this tally with what you get?

Either Irfanview is reporting the compression with a rounding/incorrectly or FME is applying the compression incorrectly. Do you have another photo package that you can use to check the compression in also? I don't I'm afraid.

Badge

Running Q= 10 in FME give me "JPEG, quality: 91, subsampling ON (2x2)" in IrfanView, whilst ISRU Display Header state: "JPEG Compressed 24 bit RGB data, Q= 9".

There are interpretations of "Q". Either how much the file has been reduced by (ISRU, FME), or what's the resulting filesize as compared to original (IrfanView).

Badge

As you can see @spatialdave1, the core issue is that setting Q is unreliable. In the example above, I need Q= 10, but get Q= 9. Other images may return slightly different values as well.

When delivering according to customer specifications, I need FME to give me what I ask. Could I have a choice if I need to enforce my settings, contra having FME dynamically set it's best output?

Userlevel 2
Badge +17

There is some good information on photo.stackexchange.com about this issue: http://photo.stackexchange.com/questions/30243/wha...

The short answer seems to be that the compression setting is target for how much information the lossy part of the JPEG algorithm can discard. The actual compression depends on the amount of detail in the image itself. A low detail image will compress more than a high detail image.

JPEG files do not store the compression quality used to create the file, so the quality reported by IrfanView or ISRU would only be an estimate.

Badge +21

A chart showing Irfanviews "compression levels" http://www.impulseadventure.com/photo/jpeg-compression.html

Reply