This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Jpeg export options

Tags: None
(comma "," separated)
irinam
Registered Member
Posts
2
Karma
0

Jpeg export options

Mon May 09, 2016 4:08 pm
Hi, I have a question about Krita's Jpeg export options. In Photoshop there are 3 radio buttons, so that one of 3 formats could be chosen: "Baseline (Standard)", "Baseline Optimized" and "Progressive". The same options in Krita can be chosen by checkboxes and there I get confused.

As I suppose, the "Force baseline JPEG" checkbox overrides the "Progressive" checkbox, so it doesn't matter if the "Progressive" checkbox is checked or unchecked, right? And what happens if the "Optimize" checkbox is checked also? Will I get the "Baseline Optimized" format or will the "Force baseline JPEG" checkbox override the "Optimize" checkbox and I will get "Baseline (Standard)" format?

Hope my question is clear enough, but if not, let's just say I need to export my Jpeg in "Baseline Optimized" format. What checkboxes should I check?

Thanks, Irina
User avatar
TheraHedwig
KDE Developer
Posts
1794
Karma
10
OS

Re: Jpeg export options

Thu May 12, 2016 8:52 am
Okay, so, if we look at the source code for our jpeg converter here, we can see that these are libjpeg api options.

So then we can discover that...

Optimize stands for "optimize_coding"
boolean optimize_coding
TRUE causes the compressor to compute optimal Huffman coding tables
for the image. This requires an extra pass over the data and
therefore costs a good deal of space and time. The default is
FALSE, which tells the compressor to use the supplied or default
Huffman tables. In most cases optimal tables save only a few percent
of file size compared to the default tables. Note that when this is
TRUE, you need not supply Huffman tables at all, and any you do
supply will be overwritten.


Force baseline refers to the quality:

jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
Constructs JPEG quantization tables appropriate for the indicated
quality setting. The quality value is expressed on the 0..100 scale
recommended by IJG (cjpeg's "-quality" switch uses this routine).
Note that the exact mapping from quality values to tables may change
in future IJG releases as more is learned about DCT quantization.
If the force_baseline parameter is TRUE, then the quantization table
entries are constrained to the range 1..255 for full JPEG baseline
compatibility. In the current implementation, this only makes a
difference for quality settings below 25, and it effectively prevents
very small/low quality files from being generated. The IJG decoder
is capable of reading the non-baseline files generated at low quality
settings when force_baseline is FALSE, but other decoders may not be.


And finally, progressive:

jpeg_simple_progression (j_compress_ptr cinfo)
Generates a default scan script for writing a progressive-JPEG file.
This is the recommended method of creating a progressive file,
unless you want to make a custom scan sequence. You must ensure that
the JPEG color space is set correctly before calling this routine.


So the first answer I can give you is that no, they don't cancel each other out.

According to wikipedia, "Baseline JPEG also supports progressive encoding.", so baseline and progressive don't cancel each other out. A progressive jpeg is just one that is similar to interlaced pngs. So a progressive jpeg with baseline quantisation just has interlaced encoding, meaning it shows a really low quality version of the image and then updates as the page loads, and that whole file has baseline encoding.

Optimize just optimizes the huffman tables used in encoding. So a baseline encoded file with prossive checked, and then the quantisation optimized for the image.

So, to answer your last question, just check baseline and optimize.

I' don't know why photoshop does it the way they do. Maybe they have their very personal implementation of jpeg, and they didn't read the jpeg specs well enough to realise these options can be combined. I wouldn't blame them, file specs are often written a bit confusingly.
irinam
Registered Member
Posts
2
Karma
0

Re: Jpeg export options

Thu May 12, 2016 12:46 pm
TheraHedwig, thanks so much for such a detailed answer. I didn't dig that deeply, so I guess the "force" word got me confused about the way it all works.

So, considering the new for me info, I would ask one more question: how the options affect the resulting image quality? I have searched for opinions and the range is broad: some people think the quality gets worse in case of "progressive" and "optimize" options, some think the quality stays unaffected and some people think that "optimize", for example, results in better quality. Usually there is no further details, though.

libjpeg.txt you provided says for the "progressive" option: "The final image after all scans are complete is
identical to that of a regular (sequential) JPEG file of the same quality
setting."
But I have not found anything about the "optimize" option.

What do you think?

P.S. I'm a photog, not an illustrator, if that makes any difference.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]