Luminous Landscape Forum

Raw & Post Processing, Printing => Digital Image Processing => Topic started by: markanini on December 13, 2015, 08:47:27 am

Title: Linear spaces look wrong in Photoshop
Post by: markanini on December 13, 2015, 08:47:27 am
Here are my exact steps:
At this point the image looks the same as from the start as expected. At step 2 however shadows look clearly visibly posterized. It's not possible use level adjustments with confidence as the image with look different by step 3. I repeat the same steps in this GIMP build http://www.partha.com/downloads/Gimp-2.9.3-color-patched-64bit-portable.exe and unlike in Photoshop I have tonal consistency in step 2. What's going on here?

EDIT: The issue is only visible for magnification factors below 67%. To rule out GPU acceleration bugs you should set Preferences>Performance>Graphics Processor Settings>Advanced Settings...>Drawing Mode:Basic

Another issue with a linear gamma working space in PS is setting black levels. The adjustment range is very coarse.

Does anyone in the community use PS and linear working spaces or do you prefer to use other software? Or do stick to gamma encoded working spaces in PS?
Title: Re: Linear spaces look wrong in Photoshop
Post by: Simon Garrett on December 13, 2015, 09:59:21 am
Here are my exact steps:
  • Open an sRGB or AdobeRGB image in Photoshop
  • Convert to a linear(gamma 1.0) RGB color space
  • Convert back to sRGB or AdobeRGB
At this point the image looks the same as from the start as expected. At step 2 however shadows look significantly darker. It's not possible use level adjustments with confience as the image with look different by step 3. I repeat the same steps in this GIMP build http://www.partha.com/downloads/Gimp-2.9.3-color-patched-64bit-portable.exe and unlike in Photoshop I tonal consistency in step 2. What's going on here?

1. In Photoshop, do your Color Settings look like this:
(http://www.simongarrett.co.uk/CapturePScolorprops.JPG)

The Working Space can be what you like, but the Color Management Policies should all be "Preserve..."   I also prefer all the "Ask..." options checked, so I know when anything is converted.  The important thing: to make sure PS preserves the colour space or converts colour space when necessary, and doesn't assign a profile or ignore colour management. 

2. Can you say what you do when you "Convert to a linear(gamma 1.0) RGB color space"?  I mean: describe what operations do you do in PS?

3. Again, please describe the steps you take to convert back.

Converting from one colour space to another, whether with linear TRC or some gamma curve, the end result should be the same - provided you use enough bit depth.  Converting to linear and back in 8 bits might leave a bit of posterisation in the blacks, as linear encoding in 8-bits doesn't have enough precision (to match human perception) at the black end. 

Of course, if you convert to a colour space whose gamut isn't large enough to contain all the colours in the image, then you get some clipped colours (and some in-gamut colours might change, depending on rendering intent). 

I don't know enough about GIMP to comment on what happens with GIMP. 
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 13, 2015, 10:35:24 am
1. In Photoshop, do your Color Settings look like this:
(http://www.simongarrett.co.uk/CapturePScolorprops.JPG)

The Working Space can be what you like, but the Color Management Policies should all be "Preserve..."   I also prefer all the "Ask..." options checked, so I know when anything is converted.  The important thing: to make sure PS preserves the colour space or converts colour space when necessary, and doesn't assign a profile or ignore colour management. 

2. Can you say what you do when you "Convert to a linear(gamma 1.0) RGB color space"?  I mean: describe what operations do you do in PS?

3. Again, please describe the steps you take to convert back.

Converting from one colour space to another, whether with linear TRC or some gamma curve, the end result should be the same - provided you use enough bit depth.  Converting to linear and back in 8 bits might leave a bit of posterisation in the blacks, as linear encoding in 8-bits doesn't have enough precision (to match human perception) at the black end. 

Of course, if you convert to a colour space whose gamut isn't large enough to contain all the colours in the image, then you get some clipped colours (and some in-gamut colours might change, depending on rendering intent). 

I don't know enough about GIMP to comment on what happens with GIMP.

1. Yes.

2. I open a high resolution sRGB TIFF, with the sRGB color space assigned, Edit>Convert to profile, under "Destination space" I set "Profile:" to my custom 1.0 gamma ProPhoto RGB profile. OK.

3. Edit>Convert to Profile, under "Destination space" I set "Profile:" sRGB.

Indeed the end result is the same, I'm using a 16-bit workflow throughout and this avoids posterization which itself may cause altered shadow levels. My problem with darkened shadows occurs after step 2.
Title: Re: Linear spaces look wrong in Photoshop
Post by: Simon Garrett on December 13, 2015, 11:17:49 am
I meant that the result should be the same even at step 2.  Colour management should ensure any tone curve is allowed for in conversion from the working space to the displayed output.

I can't immediately figure out what's going on unless there's something wrong with the linear ProPhoto RGB profile.  I assume the monitor is calibrated/profiled?
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 13, 2015, 11:29:38 am
I meant that the result should be the same even at step 2.  Colour management should ensure any tone curve is allowed for in conversion from the working space to the displayed output.

I can't immediately figure out what's going on unless there's something wrong with the linear ProPhoto RGB profile.  I assume the monitor is calibrated/profiled?

Beside using a downloaded profile I've tested using the "Custom RGB" dialog which lets you define the gamma and primaries. Even with sRGB primaries my problem arises. My monitor is calibrated and profiled using DispcalGUI.
Title: Re: Linear spaces look wrong in Photoshop
Post by: DaveRichardson on December 13, 2015, 05:39:04 pm
Markanini

I have just tried this on Photoshop CS6 (64-bit) in Windows10 and was surprised to see I got the same result as you - the deep shadows darken. My monitor is also calibrated and profiled (although mine was with i1Pro and Argyll CMS).

Not sure what is happening at this stage

Dave
Title: Re: Linear spaces look wrong in Photoshop
Post by: DaveRichardson on December 13, 2015, 06:43:41 pm
Just checked that photoshop is indeed using my working space and monitor profile correctly by loading PDI_TargetWhackedRGB.jpg and this displayed correctly. So sigh of relief there.

I think what may be happening is blocking in the shadows caused by rounding.
As an example, lightness values represented by RGB values 0-20 (21 values) in gamma 2.2 are squeezed into 0-1(2 values) in linear gamma. Even using 16-bit the same brightness range uses 5120 levels in 2.2 gamma compared to 240 in linear.
This rounding will be compounded when converting into the monitor space and sending to the monitor in 8-bit.

Dave
Title: Re: Linear spaces look wrong in Photoshop
Post by: Guillermo Luijk on December 13, 2015, 07:41:11 pm
As an example, lightness values represented by RGB values 0-20 (21 values) in gamma 2.2 are squeezed into 0-1(2 values) in linear gamma. Even using 16-bit the same brightness range uses 5120 levels in 2.2 gamma compared to 240 in linear.

Add to this that PS is not 16-bit but 15-bit. Working in linear spaces with an integer 15-bit format is definitively not a good idea. Linear gamma requires floating point formats to allow proper processing and rendering.

Regards
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 14, 2015, 02:29:21 am
@DaveRichardson would you say the issue is of the same magnitude on your setup?
http://screenshotcomparison.com/comparison/154348

Source: http://imgsv.imaging.nikon.com/lineup/dslr/d4/img/sample/img_02_l.jpg
After loading edit>Convert to Profile>Profile: ProPhotos RGB, then Profile: CustomRGB, Gamma: 1,0, OK, OK.
Title: Re: Linear spaces look wrong in Photoshop
Post by: DaveRichardson on December 14, 2015, 04:22:24 am
Yes - it varies by image and the worst for showing it are those where I had already pulled up shadow detail from the raw file.

However - this morning just as a test I switched of the "Advanced" graphics processor in Preferences - Performance and selected "Basic" in there. You have to restart photoshop for this to take effect.  With this setting I saw much less impact.

My graphics card is an ASUS HD7970-DC2 TOP 1Ghz 3GB with the latest AMD15.30.1025 driver which came with the Crimson15.11 update.

Dave
Title: Re: Linear spaces look wrong in Photoshop
Post by: DaveRichardson on December 14, 2015, 06:22:51 am
Looks like this may be a known issue between adobe and certain GPUs

https://forums.adobe.com/message/8236984#8236984

Dave
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 14, 2015, 06:39:09 am
New screenshot comparison with basic mode:
http://screenshotcomparison.com/comparison/154371
No more level shift but the posterization in the darkest shadows still makes editing unsuitable. I assume this is due to the 15-bit processing. Why is Adobe sitting on their hands?
Title: Re: Linear spaces look wrong in Photoshop
Post by: DaveRichardson on December 14, 2015, 07:02:56 am
I would suggest the posterisation is the result of the reduced bit depth in the shadows when using linear gamma.

As for the GPU issue in Advanced and Normal modes - I can't speak for Adobe - but in the link I attached, Chris Cox seems to suggest this is a GPU driver issue rather than an Adobe photoshop issue.

Dave
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 17, 2015, 08:54:29 pm
I noticed that my personal noisy images didn't suffer from the posterization that showed up on the Nikon sample photo with the clean deep shadows. With that in mind perhaps someone on this forum can suggest a good dithering function for dealing with Photoshops 15-bits.

EDIT: Nevermind it was the magnification factor. Below 64% linear images look correct. Below 64% is when the posterized display happens.
Title: Re: Linear spaces look wrong in Photoshop
Post by: Doug Gray on December 24, 2015, 03:51:23 pm
I have GPU acceleration off and a tiff gray scale patch set from 0:255

Loading it as srgb and converting to 16 bit I get the expected 15 bit values. 0, 129, 257, ...
Converting to a gamma 1.0 RGB space the first 6 patches read 0 in 16 bit mode and display as black. The first 7 patches now read 0.  They are not internally 0 though. If you go to curves and move the upper right point about 80% to the top left you will, with preview set, see the patches lighten up but the 7 black patches remain black. Flick "OK" and those patches will now display shades of gray.

Also, if you save the gamma 1 converted tiff file you will see that the proper values are in the image.

Apparently, for display purposes, Photoshop rounds to 8 bits. Also, the displayed numeric color values are rounded as well even though the underlying image is 16 bits and even if the displayed values are requested in Lab, 16, or 32 bits.


Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 24, 2015, 06:48:16 pm
Here are my exact steps:
  • Open an sRGB or AdobeRGB image in Photoshop
  • Convert to a linear(gamma 1.0) RGB color space
  • Convert back to sRGB or AdobeRGB
At this point the image looks the same as from the start as expected. At step 2 however shadows look significantly darker.
Not on this end. I built a linear profile in Photoshop (actually ProPhoto, 1.0 TRC like LR/ACR). In step 2, I see no difference after converting. I'm using the newest version of CC which has the so called high bit video path fix on Mac and I have 30-bit option enabled in preferences. Original image was in Adobe RGB (1998). Again, using Convert to Profile, the image appears the same to me in step 1 or step 2, I'm examining a 21 step wedge from black to white among other images.
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 24, 2015, 07:35:33 pm
Did you guys notice that things look different at zoom magnifications above 67%? Pay attention to this so we're not comparing apples-to-oranges.
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 24, 2015, 08:19:20 pm
Did you guys notice that things look different at zoom magnifications above 67%? Pay attention to this so we're not comparing apples-to-oranges.
My testing was done at 100%. Tried again, I see zero difference on-screen.
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 24, 2015, 08:23:45 pm
My testing was done at 100%. Tried again, I see zero difference on-screen.

You need to view below 67% to see a difference. One more interesting piece of information that you could provide: What's your display profile?
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 24, 2015, 09:03:03 pm
You need to view below 67% to see a difference. One more interesting piece of information that you could provide: What's your display profile?
Well yes, I see a slight difference under 67% but that's a bad idea for all kinds of viewing of image data in Photoshop! And other app's too. You should always be viewing at 100% for an accurate preview. And to answer your other question, I'm using an NEC SpectraView PA272. But if after all this, you're reporting an 'issue' with previews, linear data or not, below 100%, that's not something anyone should be doing. And guess what? IF I convert from Adobe RGB (1998) to sRGB and toggle the two using a view below 67%, there's a difference. So this is kind of a rabbit hole that never needed to be dug into. ;D
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 24, 2015, 10:35:24 pm
Well yes, I see a slight difference under 67% but that's a bad idea for all kinds of viewing of image data in Photoshop! And other app's too. You should always be viewing at 100% for an accurate preview. And to answer your other question, I'm using an NEC SpectraView PA272. But if after all this, you're reporting an 'issue' with previews, linear data or not, below 100%, that's not something anyone should be doing. And guess what? IF I convert from Adobe RGB (1998) to sRGB and toggle the two using a view below 67%, there's a difference. So this is kind of a rabbit hole that never needed to be dug into. ;D

Even 4k monitors arent able to view 51mp images above 67% magnification https://en.wikipedia.org/wiki/Canon_EOS_5DS
Also, did you ever try black level adjustments in a linear working space? The adjustment range is very coarse.
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 24, 2015, 11:06:44 pm
Even 4k monitors arent able to view 51mp images above 67% magnification https://en.wikipedia.org/wiki/Canon_EOS_5DS (https://en.wikipedia.org/wiki/Canon_EOS_5DS)
Also, did you ever try black level adjustments in a linear working space? The adjustment range is very coarse.
You're missing the point. The previews below a fixed level are not and have never been accurate in Photoshop. Been that way forever. There's sub-sampling going on and hence, the previews are not accurate. This has nothing to do with the gamma encoding of the data. 100% shows actual pixels!
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 25, 2015, 08:59:36 am
You made a point of working on images at 100% which is impractical. I don't agree that all inaccuracies are equal or that one shouldn't expect any accuracy at all for non 1:1 magnification.
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 25, 2015, 09:19:56 am
You made a point of working on images at 100% which is impractical. I don't agree that all inaccuracies are equal or that one shouldn't expect any accuracy at all for non 1:1 magnification.
What you reported has absolutely nothing to do with the gamma encoding of the data and has been the expected behavior in PS since 1990!
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 25, 2015, 09:23:58 am
What you reported has absolutely nothing to do with the gamma encoding of the data and has been the expected behavior in PS since 1990!
I don't try to diagnose the problem in the first place, that's why I created a thread to hear what the community had to say.
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 25, 2015, 09:34:17 am
I don't try to diagnose the problem in the first place, that's why I created a thread to hear what the community had to say.
You asked in your first post: What's going on? Now you know. This is expected behavior for previewing data in PS and many other app's.
Had you outlined your steps thoroughly by explaining you only see this below a 67% view, you would have received the answer in post #2. This is to be expected and has nothing to do with the gamma encoding. Do you see a change at 100% when you toggle linear or non linear conversions?
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 25, 2015, 09:49:04 am
You asked in your first post: What's going on? Now you know. This is expected behavior for previewing data in PS and many other app's.
Had you outlined your steps thoroughly by explaining you only see this below a 67% view, you would have received the answer in post #2. This is to be expected and has nothing to do with the gamma encoding. Do you see a change at 100% when you toggle linear or non linear conversions?
I wasn't yet aware of the roll magnification played in PS in OP. I also mentioned a another piece of software, GIMP. It still true that it gives the user the convenience of non-posterized display for linear working spaces at all magnifications. So the question still remains as to why PS does not provide the same convenience.
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 25, 2015, 10:54:40 am
So the question still remains as to why PS does not provide the same convenience.
The question was answered.
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 25, 2015, 12:33:02 pm
I have updated the OP (http://forum.luminous-landscape.com/index.php?topic=106484.0?=post=876135).
Title: Re: Linear spaces look wrong in Photoshop
Post by: Doug Gray on December 25, 2015, 05:01:50 pm
Here are my exact steps:
  • Open an sRGB or AdobeRGB image in Photoshop
  • Convert to a linear(gamma 1.0) RGB color space
  • Convert back to sRGB or AdobeRGB
At this point the image looks the same as from the start as expected. At step 2 however shadows look significantly darker. It's not possible use level adjustments with confience as the image with look different by step 3. I repeat the same steps in this GIMP build http://www.partha.com/downloads/Gimp-2.9.3-color-patched-64bit-portable.exe and unlike in Photoshop I have tonal consistency in step 2. What's going on here?

EDIT: The issue is only visible for magnification factors below 67%. To rule out GPU acceleration bugs you should set Preferences>Performance>Graphics Processor Settings>Advanced Settings...>Drawing Mode:Basic

Another issue with a linear gamma working space in PS is setting black levels. The adjustment range is very coarse.

Does anyone in the community use PS and linear working spaces or do you prefer to use other software? Or do stick to gamma encoded working spaces in PS?
Andrew pointed shadow treatment is a long standing problem with Photoshop showing up in various ways.

I only use gamma=1 for measuring absolute light levels. As Andrew pointed out, banding is there for other gammas too but is more noticeable for gamma=1 in dark shadows because vision is more sensitive to fixed light level changes at low luminance than at high. It appears when displaying images the interpolation process runs in 8 bit mode for display purposes. When looking at values in 16(15 actually) bit RGB mode they are sometimes shown as 15 bit values but rounded to 8 bits.  At other times they are correctly displayed. At least for me. Isn't clear when they are shown incorrectly but I wouldn't trust any eyedropper readings below 100%. GPU and 30bit color makes no difference in my system. Current Photoshop CC, x64 Win10, CG318.

I found this process shows the effect quite strongly.

1. Create a 2000x1500 rectangle in Adobe RGB space, 16 bit.
2. Use a gradient fill going from 0 to 255
3. Convert to gamma=1 RGB.

At 100% the gradient is quite smooth.
At 50% the gradient shows strong shadow banding.

My system switches out of banding when going from 63% to 64%. This appears slightly different from what others see.
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 25, 2015, 05:25:28 pm
Andrew pointed shadow treatment is a long standing problem with Photoshop showing up in various ways.
I don't know I'd say it's a long standing problem with Photoshop, lots of other app's behave this way in sub-sampling pixel data when zoomed out. At 100%, we're seeing one image pixel for screen pixel. We see the same preview issues producing moiré patterns too so again, this has absolutely nothing to do with gamma encoding per se, it's just how we have to deal with high rez files subsampled to the screen.
Title: Re: Linear spaces look wrong in Photoshop
Post by: Doug Gray on December 25, 2015, 05:47:34 pm
I don't know I'd say it's a long standing problem with Photoshop, lots of other app's behave this way in sub-sampling pixel data when zoomed out. At 100%, we're seeing one image pixel for screen pixel. We see the same preview issues producing moiré patterns too so again, this has absolutely nothing to do with gamma encoding per se, it's just how we have to deal with high rez files subsampled to the screen.

Moire, sure, but subsampling constant 16 bit pixels values is just a bug if they are displayed as if rounding them to 8 bits.  If a group of 16 bit pixels have a values of (60,60,60) , they should be unchanged by subsampling. Adobe Photoshop displays them incorrectly. While the bug shows up when subsampling it is not intrinsic to subsampling. Even the simplest algorithm should leave the values unchanged if their neighbors are the same.
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 25, 2015, 06:32:01 pm
Moire, sure, but subsampling constant 16 bit pixels values is just a bug if they are displayed as if rounding them to 8 bits. 
You can call it a bug if you wish. This behavior has been around for 25 years in all kinds of app's that handle pixels.
IF you have an identical grid of pixels, it shouldn’t make any difference if they are 8-bits per color or a higher value. They are the same values. The bottom line is, if accuracy of previews is critical, view at 100% or as it's really occurring and specified in Lightroom, 1:1 (1 image pixel per screen 'dot').


https://helpx.adobe.com/photoshop/using/viewing-images.html#display_images_at_100 (https://helpx.adobe.com/photoshop/using/viewing-images.html#display_images_at_100)
Display images at 100%
A zoom setting of 100% provides the most accurate view, because each image pixel is displayed by one monitor pixel. (At other zoom settings, image pixels are interpolated to a different amount of monitor pixels.)
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 25, 2015, 09:55:26 pm
Picasa, Windows Photo Viewer and Irfanview display linear gamma images without posterization. So there's no better reason for PS not to be able to do that other than "it's always done that"?.
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 25, 2015, 10:27:48 pm
Picasa, Windows Photo Viewer and Irfanview display linear gamma images without posterization. So there's no better reason for PS not to be able to do that other than "it's always done that"?.
This has nothing to do with linearization or posterization. But whatever. Meanwhile, I'll ask again before moving on: Do you see a change at 100% when you toggle linear or non linear conversions?
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 26, 2015, 10:44:21 am
This has nothing to do with linearization or posterization. But whatever. Meanwhile, I'll ask again before moving on: Do you see a change at 100% when you toggle linear or non linear conversions?
No discernable difference. Can't wait to see what you have in store for me.
Title: Re: Linear spaces look wrong in Photoshop
Post by: digitaldog on December 26, 2015, 10:58:55 am
No discernable difference.
Exactly!
Title: Re: Linear spaces look wrong in Photoshop
Post by: markanini on December 26, 2015, 11:14:18 am
Exactly!
Impressive contribution! In what context will you'll find an opportunity to restate the same point for the n-th time next?