Jump to content

Why gamma correction in ImageSizer?


chrizz
 Share

Recommended Posts

Hey everybody, especially @horst

I just realized that some of my picture suffer from a poor color quality... 

Examples:

poor resized thumb

http://www.lange-belichtung.com/site/assets/files/1212/zwei-kraene-1212.0x347.jpg

original:

http://www.lange-belichtung.com/site/assets/files/1212/zwei-kraene-1212.jpg

My question/approach was: What causes the loss of quality when using the automatic PW resize method.

My solution: In ImageSizer.php I commented out "imagegammacorrect" in line 247 & 387. Now the quality is much better than before.

I know that core hacking is not the solution more likey it's another problem :/ So my question is: Why do you use gamma correction?  

Thanks!

Chris

Link to comment
Share on other sites

http://www.4p8.com/eric.brasseur/gamma.html#introduction

or before: http://processwire.com/talk/topic/3768-processwire-231-dev-branch/page-5#entry43649

BTW: I remember well the first words from a colleague who has experience for more then 20 years working in international architecture photography bussiness after playing around 2-3 days with his first ProcessWire version of his site: "Schönes Programm, übersichtlich und einfach. Vor allem alle meine Bilder sind so klar und knackig." (english with googleTranslate: "Nice program, clear and simple. Above all, all my images are so clear and crisp.")

And be aware: by visualizing images or anything else within a website there are involved many instances. (Browser, System, Monitor). Above all, one can not make reliable statements if you do not at least use a good set hardware calibrated monitor. And even two well adjusted monitors doesn't show the exact same output. So, before going academic here, ... back to work.

Edited by horst
  • Like 2
Link to comment
Share on other sites

thanks for the links and your input. I have found another example. Perhaps somebody can take a look at the folloing two images. For me they are different (tested on different PCs, monitors, etc.). The resized one is more sharpened, the watermark is much stronger (looks like shadowed) and the dark area on the left side has lost some of it's gradient:

Original: http://www.lange-belichtung.com/site/assets/files/1240/moos-und-raureif-1240.jpg

Resized:  http://www.lange-belichtung.com/site/assets/files/1240/moos-und-raureif-1240.721x0.jpg

Actually the second one has the same dimensions as the original but it demonstrates the differences in quality between both pictures. The only thing I did was:

$original_image->width(721, array('quality' => 100))

@horst: sorry, for this missunderstanding. I don't want to say that PW resizes images in poor quality (other images are brilliant), but I saw your name in the code, so I thought: Ask horst, perhaps he have an explanation ;)

thanks everyone

Link to comment
Share on other sites

Hi everyone,

I had a similar problem with posterization/banding in darker image areas and found out the same workaround as chrizz (commenting out the gamma correction lines). I’m just guessing, but is it possible that the first gamma correction creates tonal gaps in those areas which can’t be fully reproduced afterwards?

Btw: here is a new post which seems to describe the same problem: http://processwire.com/talk/topic/5889-image-quality-problem-on-resize/

Link to comment
Share on other sites

Hi everyone,

I had a similar problem with posterization/banding in darker image areas and found out the same workaround as chrizz (commenting out the gamma correction lines). I’m just guessing, but is it possible that the first gamma correction creates tonal gaps in those areas which can’t be fully reproduced afterwards?

Btw: here is a new post which seems to describe the same problem: http://processwire.com/talk/topic/5889-image-quality-problem-on-resize/

@robert: I want to clarify here for following readers: This is definitely wrong! The artefacts has nothing to do with gamma correction. If you personally want to comment this out, please do so. But please do not give this advice to others, because you yourself have said:

... I’m not sure what that function is good for, ...

If you don't know what it is good for and on the other hand only guessing on something is not enough to give advice to other people that may also do not know for what it is good for. Gamma correction do exactly the opposite of what you say: it does not destroy colors - it saves the original colors.

@all:

Please read on in the other thread here: https://processwire.com/talk/topic/5889-image-quality-problem-on-resize/#entry57548 or just here: https://processwire.com/talk/topic/5889-image-quality-problem-on-resize/#entry57559

  • Like 2
Link to comment
Share on other sites

@horst: I’m sorry if my comment sounded like an advice or a complete solution, which is definitely wrong. I just wanted to say that it worked for me and it removed the posterization in my images. I got your link on the other thread with the explanation, I obviously missed it before – thanks for the info!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...