RSS/Atom feed Twitter
Site is read-only, email is disabled

New option "Use custom quality settings" for JPEG files

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

15 of 15 messages available
Toggle history

Please log in to manage your subscriptions.

New option "Use custom quality settings" for JPEG files Raphaël Quinet 12 Aug 23:44
  New option "Use custom quality settings" for JPEG files Sven Neumann 13 Aug 09:22
   New option "Use custom quality settings" for JPEG files Raphaël Quinet 13 Aug 10:08
    New option "Use custom quality settings" for JPEG files Alexander Rabtchevich 13 Aug 10:16
     New option "Use custom quality settings" for JPEG files Raphaël Quinet 13 Aug 11:25
      New option "Use custom quality settings" for JPEG files Alexander Rabtchevich 13 Aug 12:34
       New option "Use custom quality settings" for JPEG files Raphaël Quinet 13 Aug 13:23
      New option "Use custom quality settings" for JPEG files Liam R E Quin 13 Aug 15:11
    New option "Use custom quality settings" for JPEG files Robert L Krawitz 13 Aug 13:10
     New option "Use custom quality settings" for JPEG files Raphaël Quinet 13 Aug 13:36
      New option "Use custom quality settings" for JPEG files Liam R E Quin 13 Aug 15:12
      New option "Use custom quality settings" for JPEG files Raphaël Quinet 15 Aug 10:25
       New option "Use custom quality settings" for JPEG files Robert L Krawitz 15 Aug 13:34
        New option "Use custom quality settings" for JPEG files saulgoode@flashingtwelve.brickfilms.com 15 Aug 16:20
         New option "Use custom quality settings" for JPEG files Raphaël Quinet 22 Aug 22:55
Raphaël Quinet
2007-08-12 23:44:06 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

As discussed last month, the JPEG save dialog will now help you to pick more appropriate quality settings if your image was originally loaded from a JPEG file. Two weeks ago, I modified the jpeg plug-in so that it detects and saves the quality settings when loading a JPEG image. This includes the overall quality level, the subsampling parameters and the quantization tables if they are different from the ones that can be generated by the IJG JPEG library. The quality level and subsampling parameters of the original image will be used as initial values when saving the image if they are better than your default settings.

Since Friday, I added a new option to the JPEG save dialog: "Use custom quality settings". If some quantization tables were attached to the image when it was loaded, then this option allows you to use them instead of the standard ones (different quantization tables are generated by the IJG JPEG library for each quality level).

If you have only made a few changes to the image, then re-using the same quantization tables will give you almost the same quality and file size are the original image. This will minimize the losses caused by the quantization step, compared to what would happen if you used different quantization tables.

The following table shows several examples of JPEG files that I re-saved using three different settings: - default GIMP settings (quality 85, chroma subsampling 2x2), - similar quality and sampling parameters (detected from original), - with new option "custom quality settings" (re-use quant. tables)

The colums in the table show the mean difference in value for all pixels of the image, the maximum difference in value, the size of the DCT compressed data saved on disk (excluding comments, thumbnail and metadata) and the relative difference in size.

Mean diff. Max diff. Size on disk Nikon D70 (Fine) - 3008x2000 2521329 - Default 2.1 21 575341 -77% - Quality 98, sampling 2x1 0.6 6 2377909 -6% - Custom quantization tables 0.2 5 2471203 -2%

Nikon D70 (Normal0 - 3008x2000 3394771 - Default 3.6 31 1301350 -62% - Quality 97, sampling 2x1 0.4 10 3256047 -4% - Custom quantization tables 0.4 10 3255992 -4%

Canon G5is (Superfine) - 3264x2448 2985249 - Default 2.9 39 899083 -70% - Quality 95, sampling 2x1 1.4 14 2373022 -21% - Custom quantization tables 0.3 11 2949326 -1%

Sony DSC-D700 (Fine) - 1344x1024 676492 - Default 3.3 61 175496 -74% - Quality 97, sampling 2x1 1.4 18 603643 -11% - Custom quantization tables 0.5 17 636818 -6%

Photoshop (Save for web 100%) - 500x333 112425 - Default 3.2 45 32624 -71% - Quality 98, sampling 1x1 0.9 7 110693 -1% - Custom quantization tables 0.2 5 121285 +7%

Photoshop (Save for web 3%) - 921x921 102471 - Default 0.6 15 173831 +70% - Quality 45, sampling 2x2 2.5 17 138955 +35% - Custom quantization tables 0.0 9 112797 +10%

SonyEricsson K750i (Fine) - 1632x1224 510916 - Default 3.9 36 539013 +5% - Quality 76, sampling 2x1 0.7 35 507275 -1% - Custom quantization tables 0.1 28 507543 -1%

These examples show that re-using the same quantization tables as the original image minimizes the differences in the image and produces almost the same file size. Editing images in a lossy format such as JPEG is not recommended, but at least this new feature allows you to minimize the quality degradation in case your source images are not availabe in a lossless format.

As far as I know, this ability to re-use custom quantization tables is unique to GIMP. Even Photoshop does not allow you to do that easily. Some command-line programs such as IJG's cjpeg allow you to supply your own quantization tables, but this is not as convenient.

-Raphaël

Sven Neumann
2007-08-13 09:22:58 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

Hi Raphael,

On Sun, 2007-08-12 at 23:44 +0200, Raphaël Quinet wrote:

Since Friday, I added a new option to the JPEG save dialog: "Use custom quality settings". If some quantization tables were attached to the image when it was loaded, then this option allows you to use them instead of the standard ones (different quantization tables are generated by the IJG JPEG library for each quality level).

Why do we need an option in the GUI for this? If there are quantization tables attached and the user doesn't change the save quality, then just use them. Or is there a real disadvantage in doing that? To me it looks like you are asking the user a question that she is unlikely going to understand. And you are forcing the user to make a decision that you can better do for her.

Sven

Raphaël Quinet
2007-08-13 10:08:27 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

On Mon, 13 Aug 2007 09:22:58 +0200, Sven Neumann wrote:

On Sun, 2007-08-12 at 23:44 +0200, Raphaël Quinet wrote:

Since Friday, I added a new option to the JPEG save dialog: "Use custom quality settings". If some quantization tables were attached to the image when it was loaded, then this option allows you to use them instead of the standard ones (different quantization tables are generated by the IJG JPEG library for each quality level).

Why do we need an option in the GUI for this? If there are quantization tables attached and the user doesn't change the save quality, then just use them. Or is there a real disadvantage in doing that? To me it looks like you are asking the user a question that she is unlikely going to understand. And you are forcing the user to make a decision that you can better do for her.

I think that this option is still useful. Maybe not for disabling it when it is enabled, but for enabling it when it is not enabled automatically. It is usually better to use the custom quantization tables if they are better than your default quality settings. But if they are not better, then it is nice to give a choice to the user.

If the quantization tables found in the original file are not better than your default quality settings, then the option "Use custom quality settings" will be available but not enabled. This ensures that you always get at least the minimum quality specified in your defaults. If you did not make major changes to the image and you want to save it using the same quality as the original, then you can do it by enabling this option.

-Raphaël

Alexander Rabtchevich
2007-08-13 10:16:15 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

Why don't add such a wonderful floating tip with a short description of the switch and not to revoke the possibility from a user?

Raphaël Quinet wrote:

I think that this option is still useful. Maybe not for disabling it when it is enabled, but for enabling it when it is not enabled automatically. It is usually better to use the custom quantization tables if they are better than your default quality settings. But if they are not better, then it is nice to give a choice to the user.

Raphaël Quinet
2007-08-13 11:25:54 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

On Mon, 13 Aug 2007 11:16:15 +0300, Alexander Rabtchevich wrote:

Why don't add such a wonderful floating tip with a short description of the switch and not to revoke the possibility from a user?

This is already done. There is a tooltip associated with that option and it explains what it can be used for. Just try it an see for yourself...

Sven is right to be concerned about the number of options in the JPEG save dialog. But as I explained in my previous message, this one is useful so that is why I added it. Besides the option "Force baseline JPEG" that I removed last Friday, there are other options that could be removed in the future:
- the choice of DCT method (integer, fast but less accurate integer, or floating-point) because the speed differences are not significant anymore,
- the ability to add restart markers because unreliable channels are much less common nowadays,
- the smoothing option because this can also be performed by the usual blur filters.
All these options could still be available through the PDB interface for those who really miss them, but otherwise I think that they should be removed from the advanced options soon after GIMP 2.4 is released. It will then be time to think about redesigning the JPEG save dialog from scratch.

As I mentioned earlier, I would like to simplify that dialog and only have a dozen presets for the quality settings instead of having the 101 values in the quality slider plus the choice of chroma subsampling in the advanced options. Picking one of these presets would select the corresponding quality level (quantization tables) and the most appropriate chroma subsampling. These may still be available in the advanced options, but most users would never have to worry about them. I am not sure if the best way to make a choice among the dozen presets would be a set of radio buttons, a slider with discrete values or a combo box, but this is something that we can discuss later when we redesign that window.

-Raphaël

Alexander Rabtchevich
2007-08-13 12:34:05 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

Raphaël, I would object to removal of DCT method settings switch. Make a simple but clear test case - open any file from RAW and save it with 100% quality, 1x1,1x1,1x1 subsampling and integer vs float DCT method. Then open two resulted files as 2 layers, subtract, flatten and look at the histogram. If set upper slider to 10 and medium to 5, you will see rather significant difference between two files. The reason is to make user possible to obtain as much quality jpg as possible if he wishes so. Note, that the majority of photo labs only accepts jpgs. Also if one prefer storing his images in loss format, but as qualitatively as possibly why prevent him from doing so?

Raphaël Quinet wrote:

Sven is right to be concerned about the number of options in the JPEG save dialog. But as I explained in my previous message, this one is useful so that is why I added it. Besides the option "Force baseline JPEG" that I removed last Friday, there are other options that could be removed in the future:
- the choice of DCT method (integer, fast but less accurate integer, or floating-point) because the speed differences are not significant anymore,

Robert L Krawitz
2007-08-13 13:10:30 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

Date: Mon, 13 Aug 2007 10:08:27 +0200 From: =?UTF-8?B?UmFwaGHDq2w=?= Quinet

On Mon, 13 Aug 2007 09:22:58 +0200, Sven Neumann wrote: > On Sun, 2007-08-12 at 23:44 +0200, Raphaël Quinet wrote: > > Since Friday, I added a new option to the JPEG save dialog: "Use > > custom quality settings". If some quantization tables were attached > > to the image when it was loaded, then this option allows you to use > > them instead of the standard ones (different quantization tables are > > generated by the IJG JPEG library for each quality level). >
> Why do we need an option in the GUI for this? If there are quantization > tables attached and the user doesn't change the save quality, then just > use them. Or is there a real disadvantage in doing that? To me it looks > like you are asking the user a question that she is unlikely going to > understand. And you are forcing the user to make a decision that you can > better do for her.

I think that this option is still useful. Maybe not for disabling it when it is enabled, but for enabling it when it is not enabled automatically. It is usually better to use the custom quantization tables if they are better than your default quality settings. But if they are not better, then it is nice to give a choice to the user.

If the quantization tables found in the original file are not better than your default quality settings, then the option "Use custom quality settings" will be available but not enabled. This ensures that you always get at least the minimum quality specified in your defaults. If you did not make major changes to the image and you want to save it using the same quality as the original, then you can do it by enabling this option.

Would "Use existing image quality settings" be a better name for this?

Raphaël Quinet
2007-08-13 13:23:48 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

On Mon, 13 Aug 2007 13:34:05 +0300, Alexander Rabtchevich wrote:

Raphaël, I would object to removal of DCT method settings switch. Make a simple but clear test case - open any file from RAW and save it with 100% quality, 1x1,1x1,1x1 subsampling and integer vs float DCT method. Then open two resulted files as 2 layers, subtract, flatten and [...]

I never claimed that the 3 DCT methods provide the same results. But since all current computers execute this step in almost the same time, it does not make much sense to present this option to the user if we can instead always default to the most accurate method (i.e., the best quality).

Unless you have a good reason to use a less accurate DCT method, I do not think that we should keep this option in the dialog. We can still offer it via the PDB, though.

-Raphaël

Raphaël Quinet
2007-08-13 13:36:05 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

On Mon, 13 Aug 2007 07:10:30 -0400, Robert L Krawitz wrote:

Date: Mon, 13 Aug 2007 10:08:27 +0200 From: =?UTF-8?B?UmFwaGHDq2w=?= Quinet [...]
If the quantization tables found in the original file are not better than your default quality settings, then the option "Use custom quality settings" will be available but not enabled. This ensures that you always get at least the minimum quality specified in your defaults. If you did not make major changes to the image and you want to save it using the same quality as the original, then you can do it by enabling this option.

Would "Use existing image quality settings" be a better name for this?

"existing" could be interpreted as "the settings that are currently displayed in this window", which would not make much sense and would just confuse some users.

I considered naming this option "Use original quality settings", but one thing that I forgot to mention in my previous messages is that it is possible to write a script or plug-in that attaches different quantization tables to any image. That would allow you to create an image from scratch or from an existing file and then save it as some other programs or devices would save it (e.g., save as "Photoshop quality 12" or save as "Nikon D70s Fine"). In fact, I am planning to release such a script soon. I have already started extracting quantization tables from a large number of JPEG images. Considering that the quantization tables attached to an image would not always be the original ones, I decided to write "custom" instead of "original" for the label of that option. It is not perfect, but I have not been able to find a better description..

-Raphaël

Liam R E Quin
2007-08-13 15:11:30 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

On Mon, 2007-08-13 at 11:25 +0200, Raphaël Quinet wrote: [...]

- the smoothing option because this can also be performed by the usual blur filters.

Actually no, I don't think it can :-)

The smoothing seems to reduce jpeg artifacts quite noticeably; it appears as if it's done after decompression... although I might easily be mistaken.

Liam

Liam R E Quin
2007-08-13 15:12:46 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

On Mon, 2007-08-13 at 13:36 +0200, Raphaël Quinet wrote:

[...]

Considering
that the quantization tables attached to an image would not always be the original ones, I decided to write "custom" instead of "original" for the label of that option. It is not perfect, but I have not been able to find a better description..

It sounds like "Use quantization tables that are embedded in the image" is what you mean?

Liam

Raphaël Quinet
2007-08-15 10:25:54 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

On Mon, 13 Aug 2007 13:36:05 +0200, Raphaël Quinet wrote:

On Mon, 13 Aug 2007 07:10:30 -0400, Robert L Krawitz wrote:

Would "Use existing image quality settings" be a better name for this?

I considered naming this option "Use original quality settings", but one thing that I forgot to mention in my previous messages is that it is possible to write a script or plug-in that attaches different quantization tables to any image. [...]

Although I was a bit reluctant to do this, we could try to change the name of this option to "Use original quality settings" or "Use quality settings from original image" or something like that. This would require several changes in behavior explained below. This new meaning may not be appropriate if other quantization tables than the original ones are attached to the image, but if we consider that usage to be an exception, then maybe we can "optimize for the common case" if this could make the option more understandable. Anyway, if we want to change that string, then we have to reach a consensus on that in the next few hours and make sure that it will not change again until GIMP 2.4 is out. We should be in string freeze now.

If we change the label, this also changes the meaning of the option and this will require some changes to the code:

- Currently, "Use custom quality settings" is only available when the quantization tables are non-standard ones. If the tables can be generated by the IJG JPEG library, then the option is grayed out because the user can get the same table with the existing "quality" slider (and that slider is already set to the right value if the quality of the original file is better than the user's default). If that option is changed to mean "I want the same settings as the original image" instead of "I want to use some non-standard tables", then that option should always be available even if the original image used standard quantization tables.

- Enabling that option should not only change the quality slider, but it should also change the choice of subsampling parameters, even if the chroma subsampling in the original image is not as good as the user's defaults (i.e., if the default is 1x1 and the original image used the lower quality 2x2 or 2x1). This would ensure that all significant parameters from the original image are re-used when saving. Note that it would be a one-way change: enabling the option "Use original quality settings" would change the subsampling parameters, but changing the subsampling parameters later would not disable the option (unlike what is done when the quality slider is moved).

- Optionally, the usage (or not) of optimized Huffman tables could be detected in the original image and re-used when saving. I think that it would be better to leave it always enabled (always optimize) but if we want to be as close as possible to the original image, then we could disable the optimization if the original image was not optimized.

Implementing these changes would be easy (except for the last one, maybe) and I know exactly what would have to be be changed so the code itself is not an issue here. But we should quickly decide what this option should mean. I like the current meaning ("custom tables") but some of you think that it would be easier to understand something referring to the original quality settings. If we can reach a quick agreement on what is better (considering the differences explained above) and if it is not too late for 2.4rc1, then maybe I could change that option.

-Raphaël

Robert L Krawitz
2007-08-15 13:34:09 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

Date: Wed, 15 Aug 2007 10:25:54 +0200 From: =?UTF-8?B?UmFwaGHDq2w=?= Quinet

On Mon, 13 Aug 2007 13:36:05 +0200, Raphaël Quinet wrote: > On Mon, 13 Aug 2007 07:10:30 -0400, Robert L Krawitz wrote: > > Would "Use existing image quality settings" be a better name for this? >
> I considered naming this option "Use original quality settings", but > one thing that I forgot to mention in my previous messages is that > it is possible to write a script or plug-in that attaches different > quantization tables to any image. [...]

Although I was a bit reluctant to do this, we could try to change the name of this option to "Use original quality settings" or "Use quality settings from original image" or something like that. This would require several changes in behavior explained below. This new meaning may not be appropriate if other quantization tables than the original ones are attached to the image, but if we consider that usage to be an exception, then maybe we can "optimize for the common case" if this could make the option more understandable. Anyway, if we want to change that string, then we have to reach a consensus on that in the next few hours and make sure that it will not change again until GIMP 2.4 is out. We should be in string freeze now.

...

Implementing these changes would be easy (except for the last one, maybe) and I know exactly what would have to be be changed so the code itself is not an issue here. But we should quickly decide what this option should mean. I like the current meaning ("custom tables") but some of you think that it would be easier to understand something referring to the original quality settings. If we can reach a quick agreement on what is better (considering the differences explained above) and if it is not too late for 2.4rc1, then maybe I could change that option.

The problem is that "custom tables" seems very confusing -- it sounds like the user's going to be asked to input something she knows nothing about. One could argue that "Use existing image quality settings" means the same thing as "Use quality settings currently attached to the image", and then nothing about the behavior would have to change.

saulgoode@flashingtwelve.brickfilms.com
2007-08-15 16:20:48 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

Quoting Robert L Krawitz :

The problem is that "custom tables" seems very confusing -- it sounds like the user's going to be asked to input something she knows nothing about. One could argue that "Use existing image quality settings" means the same thing as "Use quality settings currently attached to the image", and then nothing about the behavior would have to change.

My only comment on this issue is that the term "image" is consistently employed within the GIMP vocabulary to mean the "in-memory" copy of the picture being edited (when an image is duplicated, scaled, changed mode, etc., the file is not affected). It would be confusing to use the term "image" to describe a file attribute that is basically independent of the in-memory data.

Raphaël Quinet
2007-08-22 22:55:25 UTC (about 17 years ago)

New option "Use custom quality settings" for JPEG files

On Wed, 15 Aug 2007 10:20:48 -0400, saulgoode@flashingtwelve.brickfilms.com wrote:

Quoting Robert L Krawitz :

The problem is that "custom tables" seems very confusing -- it sounds like the user's going to be asked to input something she knows nothing about. One could argue that "Use existing image quality settings" [...]

My only comment on this issue is that the term "image" is consistently employed within the GIMP vocabulary to mean the "in-memory" copy of the picture being edited [...]

I think that using the terms "original image" would avoid this problem.

We are basically left with two options:

1) "Use custom quality settings" - Hard to understand for most users - Technically correct description - No need to change the code; this is what we have now

2) "Use quality settings from original image" - Easier to understand for most users - Correct description for the most common usage scenario - Requires some small changes to the code - Breaks the string freeze before 2.4

It seems that going for (2) would be better for the users but would annoy some translators. But I got several requests to go for something like option (2), so I would like to know if it is worth breaking the string freeze. Opinions?

-Raphaël

P.S.: please do not mention bikesheds.