POV-Ray : Newsgroups : povray.general : image_maps: using .png vs .bmp file type Server Time
27 Dec 2024 21:41:19 EST (-0500)
  image_maps: using .png vs .bmp file type (Message 1 to 8 of 8)  
From: Kenneth
Subject: image_maps: using .png vs .bmp file type
Date: 21 Nov 2005 22:55:00
Message: <web.438295088e663eafa7b7bf6c0@news.povray.org>
Wasn't sure if this belonged in the "POV for Windows" newsgroup, so I posted
it here...

In all the time I've been working with POV for Windows, I've used Photoshop
--on my Mac--to create images for use as heightfields and image_maps. And
I've saved the images as either a .bmp or a .png file type, depending
on...whim. Sometimes I've seen "anomolies" in my POV-rendered scenes, but
just passed them by (I was too busy learning POV!)...not realizing until
now that the .png file type itself might be introducing these anomolies. I
say MIGHT...

Another news thread got me to thinking about all this; it's here...

http://news.povray.org/povray.binaries.images/thread/%3Cweb.4373fd35d28cb00fed802ab30%40news.povray.org%3E/?mtop=220515


I create my image_map images in Photoshop 4.01 on the Mac (prehistoric, I
know) then port them over to my PC for inclusion in a POV scene file. (This
is how I'm used to working, as I began computer life on a Mac long before
buying a PC.) And most times, I don't alter my image_map images in my PC's
newer version of Photoshop (v5.5).  Ah, but sometimes I do...and I've
finally discovered the cause of the anomolies--specifically with .png
images vs. .bmp images vs. gamma. AND how to fix them.

I ran some experiments, which I detail here (and I've purposely left out the
"use assumed_gamma of 1.0" suggestion altogether, for clarity.)

First, the set-up:
I have an older PowerMac system and a not-as-old PC (a Pentium II), both
with 17" CRT monitors.
In my PC, where I run POV for Windows, I've set monitor gamma, POV's
assumed_gamma and display_gamma all to 1.8--in order to match my Mac's
monitor/computer combo (my "standard candle" for these tests) to make
images on both platforms display equally. The PC monitor's gamma is
configured using the Adobe Gamma control panel app (and tested using POV's
gamma setup info.)  SO...gamma is set to 1.8 everywhere on both computer
systems, and everywhere(?) within POV-Ray. And I took the time to
(visually) match both monitors' color, brightness and contrast.

Now, the experiments...
1) Create image_map in Photoshop on the Mac, with PS's own gamma set to 1.8
(in the FILE:COLOR SETTINGS:MONITOR SETUP dialog box.) Save PS image as
..bmp file. Port it over to PC. Run POV scene, of an object mapped with this
image_map, and with object's finish set to ambient 1 diffuse 0. View final
image in POV's preview window, and output rendered image as .bmp file type
(POV's default output for Windows.)  Port that rendered image back over to
Mac, bring it up in Photoshop.  Results:  rendered image is IDENTICAL on
both monitors (as identical as my eyes can see), and identical to original
Mac-created image. As would be expected.

NOW, in PC, I start Photoshop 5.5, and in FILE:COLOR SETTINGS:RGB SETUP, set
gamma to 1.8 and check the box called "Display Using Monitor Compensation."
Then in FILE:COLOR SETTINGS:PROFILE SETUP, I leave everything blank--no
"embedded RGB profiles", "assumed profiles" or "profile mismatch handling"
whatever.

2) in PC, open .bmp image in Photoshop 5.5, do nothing to it, then re-save
it (as .bmp again.)  Run POV scene as before (again, output as .bmp file
type), port that file over to Mac, bring it up in Photoshop.  Results:
Again, the rendered scene is IDENTICAL on both monitors.

3) In Photoshop on the Mac, save original image as .png file type rather
than .bmp. (This, I assume, "embeds" a "display gamma" of 1.8 into the .png
file.) Port this over to PC, run POV scene with this. Results:  IDENTICAL
again (both within POV scene itself--compared to previous .bmp image_map--
and on Mac.)

Now comes the problem...
4)  In PC, open the newly-created .png image in Photoshop 5.5, add nothing
to it,  and save it (as .png again.) Run POV scene with it.  Results within
POV: The image_map image is now darker, with more contrast...looking like a
major gamma alteration. Not a subtle change, but a big one. Yet opening
this .png image again in Photoshop on the PC shows its
contrast/brightness/gamma to be unaltered! (Turning off "Display Using
Monitor Compensation" has no effect either.) Porting this "altered" .png
image back over to the Mac, and viewing it in Photoshop there, also shows
it to be unaltered.  (BTW, the rendered POV image still looks identical on
both Mac and PC.)

I'm really mystified as to what's going on: Is Photoshop 5.5  altering the
gamma value within the .png image, without being told to do so? (But then,
why would it look unaltered on a different version of Photoshop running on
a different computer/monitor combo?) Or is POV handling .png images oddly?
OR, is Photoshop 5.5, the way I have it configured, "stripping" gamma info
from the file when it's saved? WHATEVER the reason, it's an irritating
problem.

There are two different ways I've found to get this "altered" .png image to
render "unaltered" in POV:

1) In POV, leave both assumed_gamma and display_gamma at 1.8, but change
monitor's own gamma to 1.  (Actually, making assumed_gamma any value has no
effect here.) Not a good way to work, though; EVERY image on the PC
monitor, in whatever app,  is now way too bright.

OR...
2) In PC's Photoshop, go to FILE:COLOR SETTINGS:RGB SETUP, change its gamma
to 1, and leave the "Display Using Monitor Compensation" box checked.  Now
open the previously-altered .png file. Right away, the image "brightens up"
and gets washed out. But I re-save it, as .png again. In POV, it now
renders perfectly, unaltered from its original Mac-created appearance!  Not
sure I understand that...but it's fixed, so I can't complain.  Is Photoshop
now "tagging" the .png image with a "display gamma" of 1? But that doesn't
make sense either.  (To get rid of the "washed out" look in Photoshop, I
UNCHECK the "Display Using Monitor Compensation" box.  Now I see an
UNALTERED image in both Photoshop and in POV rendering.) Actually, the
rendered image_map looks MOST like the original Mac-created one if PS 5.5
gamma is set to .9 rather than 1.  Odd.

Let me reiterate that I'm visually cross-checking the image_map image using
three different, simultaneous "techniques": The original (as well as
altered) .png image file in Photoshop 4.01 on the Mac, the "altered" .png
image in Photoshop 5.5 on the PC, and the rendered version of the image_map
in POV's preview window. Using 2) above, they all look identical once
again.

CONCLUSIONS:  Any Photoshop images I create on the Mac for image_maps will
be saved as .bmp, not .png, so that I don't have to deal with this crazy,
unfathomable .png idiosyncracy!

OR

If I ever open a Mac-created .png image again in my PC's Photoshop 5.5 and
then save it, I'll first change PS 5.5 settings to gamma of 1 (or .9) and
NO "Display Using Monitor Compensation."

Some postscripts...
Bringing up the Mac's (unaltered) .png image in PC's Photoshop -- with PS
gamma set to 1.8 (and monitor set to that as well) -- shows no change,
whether using "Display Using Monitor Compensation" or not...so Photoshop is
matching the PC monitor's gamma value very well (which is set with Adobe
Gamma, so that's not surprising!) And it matches the Mac's display of the
image as well.

Interestingly, if I bring the altered (OR unaltered Mac-version) .png image
up in Window's Picture Viewer app, it doesn't quite match the PC's
Photoshop display of the image (with "Display Using Monitor Compensation"
on.) PV's version is a bit brighter. Changing Photoshop's gamma to 1.45
equalizes them. Strange.

Bringing up the PC's POV rendered scene (a .bmp image) in Picture Viewer
exactly matches the POV preview image.


Post a reply to this message

From: Warp
Subject: Re: image_maps: using .png vs .bmp file type
Date: 22 Nov 2005 02:53:15
Message: <4382ce6b@news.povray.org>
It would be interesting to see that if you remove gamma information
completely from the png (I don't know if photoshop can do this, but at
least gimp can) if the problem still persists.

-- 
                                                          - Warp


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: image_maps: using .png vs .bmp file type
Date: 22 Nov 2005 04:26:21
Message: <op.s0mxuelzcs6ysw@frogeater.bredbandsbolaget.se>
I am not sure if this is what is causing your problems, but PC software  
has a tendency to assume that the monitor has a gamma of 2.2. Adjusting  
your monitor to make it have a gamma of 1.8 can make such software produce  
bad results.


> I've purposely left out the "use assumed_gamma of 1.0" suggestion  
> altogether

I take this to mean that you have tried it, and it made no difference. Not  
surprising, given that you have calibrated both monitors to match.


> Now comes the problem...
> 4)  In PC, open the newly-created .png image in Photoshop 5.5, add  
> nothing
> to it,  and save it (as .png again.) Run POV scene with it.  Results  
> within
> POV: The image_map image is now darker, with more contrast...looking  
> like a
> major gamma alteration.

Sounds like the result of PS writing a gamma value of 2.2 to the file,  
even though it was created for gamma 1.8.

Have you examined the files to see what the gamma chunk says?


> Changing Photoshop's gamma to 1.45 equalizes them. Strange.

Note that the ratio 1.45/1.8 is very close to 1.8/2.2.



-- 
FE


Post a reply to this message

From: Kyle
Subject: Re: image_maps: using .png vs .bmp file type
Date: 22 Nov 2005 19:38:40
Message: <bbe7o1ph2d1c2nhs0je6akhmasv501rrof@4ax.com>
You may want to check out my experiences with image gamma in POV-Ray
in the following thread:

http://news.povray.org/povray.general/thread/%3Cvsbbd1dtllv2mb049bvsgtv1egu161sp9g%404ax.com%3E/

I created a macro to help with the issue I was having.

Hope this helps!


Kyle


Post a reply to this message

From: Kenneth
Subject: Re: image_maps: using .png vs .bmp file type
Date: 29 Nov 2005 03:00:00
Message: <web.438c097b2ff76de3cb3448c30@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> It would be interesting to see that if you remove gamma information
> completely from the png (I don't know if photoshop can do this, but at
> least gimp can) if the problem still persists.
>
> --
>                                                           - Warp

Hi. Sorry for the late reply; I've been on vacation.

There doesn't *seem* to be any way to remove gamma using Photoshop (my
versions, anyway). Don't yet have a copy of GIMP, but I can see that it
would be useful. An interesting experiment to try.

Ken


Post a reply to this message

From: Kenneth
Subject: Re: image_maps: using .png vs .bmp file type
Date: 29 Nov 2005 03:15:00
Message: <web.438c0d1c2ff76de3cb3448c30@news.povray.org>
"Fredrik Eriksson" <noo### [at] nowherecom> wrote:
> I am not sure if this is what is causing your problems, but PC software
> has a tendency to assume that the monitor has a gamma of 2.2. Adjusting
> your monitor to make it have a gamma of 1.8 can make such software produce
> bad results.
>

Yet both .bmp and "unaltered" .png image_map images look identical on both
my PC and Mac (both monitors set to gamma of 1.8), in both versions of
Photoshop and in the final POV rendered scene on the PC. It's only the
"altered" .png file that causes problems.

>
> > I've purposely left out the "use assumed_gamma of 1.0" suggestion
> > altogether
>
> I take this to mean that you have tried it, and it made no difference....
>
Actually, no. I'm still not totally convinced of its usefulness...mainly
because I'm STILL trying to understand its pros and cons.  The set-up I now
have seems to "work for me, " so I haven't gone that route yet.  Although,
I do (sort of!) understand that a scene file to be shared with others may
need it, for rendering consistency.
>

>
> Have you examined the files to see what the gamma chunk says?

I have to admit ignornace there; how does one go about doing that?
>
>
> > Changing Photoshop's gamma to 1.45 equalizes them. Strange.
>
> Note that the ratio 1.45/1.8 is very close to 1.8/2.2.
>
That's VERY interesting!! I didn't notice that before.

Thanks for the tips.

Ken


Post a reply to this message

From: Kenneth
Subject: Re: image_maps: using .png vs .bmp file type
Date: 29 Nov 2005 03:20:01
Message: <web.438c0ecb2ff76de3cb3448c30@news.povray.org>
Kyle <hob### [at] gatenet> wrote:
> You may want to check out my experiences with image gamma in POV-Ray
> in the following thread:
>
>
http://news.povray.org/povray.general/thread/%3Cvsbbd1dtllv2mb049bvsgtv1egu161sp9g%404ax.com%3E/
>
> I created a macro to help with the issue I was having.
>
> Hope this helps!
>
>
> Kyle

Thanks, Kyle. Actually, I did take a look at that thread awhile back, but
unfortunately *forgot* about it, in my testing zeal!  :-)


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: image_maps: using .png vs .bmp file type
Date: 29 Nov 2005 05:58:45
Message: <op.s0z0szrncs6ysw@frogeater.bredbandsbolaget.se>
On Tue, 29 Nov 2005 09:11:08 +0100, Kenneth <kdw### [at] earthlinknet>  
wrote:
> "Fredrik Eriksson" <noo### [at] nowherecom> wrote:
>> I am not sure if this is what is causing your problems, but PC software
>> has a tendency to assume that the monitor has a gamma of 2.2. Adjusting
>> your monitor to make it have a gamma of 1.8 can make such software  
>> produce
>> bad results.
>>
>
> Yet both .bmp and "unaltered" .png image_map images look identical on  
> both
> my PC and Mac (both monitors set to gamma of 1.8), in both versions of
> Photoshop and in the final POV rendered scene on the PC. It's only the
> "altered" .png file that causes problems.

Exactly. The bmp has no gamma information. The unaltered png has either no  
gamma information, or a gamma of 1.8 (the "correct" value). The altered  
png probably has a gamma of 2.2, which makes it misbehave because the  
image data is actually gamma 1.8.

Interestingly, I found this tidbit in the PS help files:

"Note: Images created in Photoshop 5.0 or later use the Windows gamma  
value (2.2) by default and are at the correct gamma for display in Windows  
with no adjustment."

I assume they meant just the Windows versions of PS though.



>> > I've purposely left out the "use assumed_gamma of 1.0" suggestion
>> > altogether
>>
>> I take this to mean that you have tried it, and it made no  
>> difference....
>>
> Actually, no. I'm still not totally convinced of its usefulness...mainly
> because I'm STILL trying to understand its pros and cons.  The set-up I  
> now
> have seems to "work for me, " so I haven't gone that route yet.   
> Although,
> I do (sort of!) understand that a scene file to be shared with others may
> need it, for rendering consistency.

That is indeed its purpose, as far as I understand it.



>> Have you examined the files to see what the gamma chunk says?
>
> I have to admit ignornace there; how does one go about doing that?

Off-hand, I can only point to one program, and I wrote that myself...

http://hem.bredband.net/b230591/hdr2exr/hdr2exr_win32.zip

Run it like this:
hdr2exr --verbose suspect_image_file.png %TEMP%\dummy.png

It should then tell you the gamma value encoded in the file.

You can also use that program to correct an erronous gamma value.



-- 
FE


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.