Gamma correct scaling

nou

Active member
Try to open these image in your favorite (like PixInsight) image software and scale them down to 50% size. Then try to think why you get so wrong result.

gamma_dalai_lama_gray.jpg
gamma-1.0-or-2.2.png

gamma_colors.jpg

More information here http://www.ericbrasseur.org/gamma.html
 
I inspected image of Dalai Lama. It is composed of two fields in alternating rows: the left side shows the field of even rows, right side shows the field of odd rows.

TestImage_neu.jpg


Honestly, I don't know what you want to tell us in your post.

Bernd
 
That when you scale down Dalai Lama image you get gray square. These colour squares will get totally different colours when you scale down it by 50%.
Here is comparison between GIMP and PixInsight resample tool. What do you think is correct?
pix_dalailama.png
 
Please use IntegerResample with option 'Downsample mode' set to 'maximum'. This is the result:

TestImage_IntegerResample_max.jpg


Bernd
 
Well, I think it's clear from the first post: your scaling software sucks! ???

The problem here is that PixInsight implements pure geometric transformations. By 'pure' I mean that the existing pixel values in the image are always being interpolated to generate the transformed image, not the values transformed non-linearly by applying a gamma (exponential) operation in order to provide perceptually valid results. This is by design, mainly because PixInsight is intended to be used in technical fields such as astronomy, where we must preserve the data as much as possible even if this destroys some perceptual properties.

That said, an option to interpolate gamma-corrected values could be added to geometrical processes (Resample, Rotation, etc). This is now in the to-do list, although with very low priority, given the amount of work that we have at present. Thank you for pointing out (well, remembering, actually) this.
 
Raw data from FITS are in 99% of case linear. So doing pure geometric transformations are correct. Until you do histogram transformation or other operation that stretch data and makes them non-linear. After that doing resample will produce slightly incorrect results.

So currently if you want to get 100% correct result any resampling needs to be done before any stretch operation. I think easiest (for you developers) solution would be add new process that can do linear<->sRGB curve transformation so power user can convert already stretched image to linear mode do resampling operation and convert back to perceptual gamma.
 
Actually, the changes necessary to implement this are so simple that it took about 10 minutes and was a nice break in the middle of other tasks:

gamma-correction.png


So count on a gamma correction feature implemented in at least the Resample, Rotation, DynamicCrop and IntegerResample tools in an incoming update. Thanks for pointing this out. Our scaling software may not suck anymore ;)
 
That is awesome. (y) Probably best is leave it unchecked by default to preserve old behaviour. Then add into tooltip that for linear data you want to have it unchecked and for stretched non-linear it should be checked.
 
Hi again. I have just released an update to the Geometry module that implements gamma-corrected interpolation in the DynamicCrop, IntegerResample, Resample and Rotation tools. Thank you so much for reporting this problem and its solution. Thank you also for your patience, and sorry for taking so long to implement this feature.
 
  • Like
Reactions: nou
Back
Top