Gamma Correct Resizing

Ideas for improvements and requests for new features in XnView Classic

Moderators: XnTriq, xnview

Post Reply
robofunk
Posts: 1
Joined: Thu Feb 07, 2008 9:55 pm

Gamma Correct Resizing

Post by robofunk » Fri Feb 08, 2008 2:28 am

Here is a very interesting website about gamma error in picture scaling.
Technically speaking, the problem is that "the computations are performed as if the scale of brightnesses was linear while in fact it is an exponential scale." In mathematical terms: "a gamma of 1.0 is assumed while it is 2.2." Lots of filters, plug-ins and scripts probably make the same error."
I've tested XnView and it definitely exhibits the gamma error described on the page. It would be a great if XnView added the feature to use gamma correct scaling. It could even be made the default if desired. The examples on the page are very compelling.

The incorrect method is shown first:
http://www.4p8.com/eric.brasseur/gamma_17.html
http://www.4p8.com/eric.brasseur/gamma_01.html
http://www.4p8.com/eric.brasseur/gamma_19.html
http://www.4p8.com/eric.brasseur/gamma_13.html

Generally it seems more detail is preserved with gamma correct resizing and the gamma is obviously correct.

Please consider this feature. As argued by the site XnView would be one of the few softwares that maintains correct gamma when resizing.

pic_viewer
Posts: 251
Joined: Sat Nov 17, 2007 7:53 am
Location: Germany

Post by pic_viewer » Fri Feb 08, 2008 3:44 am

Support!

User avatar
helmut
Posts: 8185
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut » Fri Feb 08, 2008 10:16 am

Uhh. :-| The resize algorithms including Lanczos really struggle with the sample image "Dalai Lama".

pic_viewer
Posts: 251
Joined: Sat Nov 17, 2007 7:53 am
Location: Germany

Post by pic_viewer » Fri Feb 08, 2008 11:28 am

Question: does this also affect or is relevant for the normal view zoom mode (downscale)?

plarry
Posts: 23
Joined: Sun Feb 03, 2008 11:55 pm
Location: Dresden

Post by plarry » Fri Feb 08, 2008 12:47 pm

That should be built in.

//edit:

A "System Gamma" input field would be good for this, as found in some compositing packages. (As an addition, maybe replacement, to the already existing "Gamma Correction")

:arrow: Pic_Viewer, yes, this also affects the regular downscale preview.

And as a sidethrought, there is a reason this one got so long ignored, one hardly ever notices it, and, you can always work around when it becomes an issue. If gamma is way off you'll notice anyway. Nevertheless would be nice if it will be built in...

User avatar
oops66
XnThusiast
Posts: 1999
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: Gamma Correct Resizing

Post by oops66 » Thu Jun 06, 2013 11:16 am

robofunk wrote:...Please consider this feature. As argued by the site XnView would be one of the few softwares that maintains correct gamma when resizing. ...http://www.4p8.com/eric.brasseur/gamma.html#examples
...
... Right interesting, so every pictures softwares should take care with this gamma correction when resizing pictures (zoom in & out too) .
Does XnView 2.0 & XnViewMP 0.51 do this automatically ?

...And for Nconvert is it he same way as convert ?

Code: Select all

ImageMagick
First of all a warning: ImageMagick is regularly being enhanced and transformed. What you read here is how things worked for me when I made tests with ImageMagick. Read it to get some understanding of the general ideas. But it may not work on the version of ImageMagick you are using. You may have to adapt.

The ImageMagick library allows to convert images to 16bit format and to change the gamma. This command performs the whole chain of operations to resize an image named in.png to an image named out.png. The image is scaled down to 50%:

convert in.png -depth 16 -gamma 0.454545 -resize 50% -gamma 2.2 -depth 8 out.png

You can replace the "-resize 50%" with any set of operations on the image that you want to be performed correctly.
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

User avatar
XnTriq
Moderator & Librarian
Posts: 5543
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Gamma Correct Resizing

Post by XnTriq » Thu Jun 06, 2013 9:30 pm

oops66 wrote:Does XnView 2.0 & XnViewMP 0.51 do this automatically ?
I don't think we have an “official statement” from Pierre.
Eric Brasseur ([url=http://www.4p8.com/eric.brasseur/gamma.html]Gamma error in picture scaling[/url]) wrote:Yet other non-gamma compliant software seem to be Paint.NET, Google Picasa, Irfanview, Python Imaging Library 1.1.6, ITT IDL 7.0, ImageJ 1.40, XNview/NConvert 1.97.5, Opera, Google Chrome, KolourPaint...
Martin Breidt ([url=http://scripts.breidt.net/gamma_correct_v12.pdf]Be gamma correct[/url]) wrote:Other examples of software not using gamma correction when scaling images are Gimp, XnView, Matlab, Word, Firefox.

Post Reply