Pages: [1] 2   Go Down

Author Topic: Questions about 0-255 scale  (Read 9632 times)

silverimage

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Questions about 0-255 scale
« on: December 02, 2014, 11:09:28 pm »

Hallo all. I'm newly registered to LuLa although I read here pretty regularly. I am not new to imaging, but not an expert either. I have a question which might sound stupid, but which I have been musing on, and could not find out about from searching here/on the internet in general.

Regarding the 0-255 scale in softwares such as PhotoShop.
If you are dealing with an 8-bit image, it is normal and correct. But if you are working with a 16-bit image, then in actuality the scale of possible pixel values runs from 0-65535. If I understand correctly, there are, in effect, another 256 'steps' in between each of the one-integer increments in the 0-255 scale.
- Why do softwares still show the 0-255 scale for 16-bit? Is this just convention and/or the fact that a 0-66535 0-32768 (edited per Kirk's info given in post below) scale would be confusing and unwieldy?
- How can one accurately judge clipping, if there are all these 'invisible' 16-bit values between 254 and 255?
- How does this scaling work in regard to RAW files?  They aren't processed to either 8-bits or 16-bits, so what is the connection between the scale and the RAW information? Is it a calculation of the values the pixels will have once processed?

I will appreciate any answers or input people have. And once again, please excuse me if I just did not find what is a simple answer! Thank you.
« Last Edit: December 03, 2014, 12:57:39 am by silverimage »
Logged

kirkt

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 604
Re: Questions about 0-255 scale
« Reply #1 on: December 02, 2014, 11:32:29 pm »

Photoshop 16bit color is really 15bits+1 for a range of 0 to 32768 (or 2^15 + 1).  You can access the 16bit RGB values in the info palette - see attached screenshot.

It is probably more intuitive to think about RGB color triplets in 0-255 terms, even though we know we are working in 16bit color.

kirk
« Last Edit: December 02, 2014, 11:55:25 pm by kirkt »
Logged

silverimage

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Re: Questions about 0-255 scale
« Reply #2 on: December 02, 2014, 11:37:01 pm »

Dear Kirk, Thank you for your reply.

Why is the 16-bits actually 15 though? That is ... not intuitive
Logged

kirkt

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 604
Re: Questions about 0-255 scale
« Reply #3 on: December 02, 2014, 11:50:10 pm »

Re: 15bit + 1 convention.   Here is one explanation:

Quote
If an 8-bit channel consists of 256 levels, a 10-bit channel consists of 1,024 levels, and a 12-bit channel consists of 4,096 levels, doesn’t it follow that a 16-bit channel should consist of 65,536 levels?

Well, that’s certainly one way that a 16-bit channel could be constructed, but it’s not the way Photoshop does it. Photoshop’s implementation of 16 bits per channel uses 32,769 levels, from 0 (black) to 32,768 (white). One advantage of this approach is that it provides an unambiguous midpoint between white and black (useful in imaging operations such as blending modes) that a channel comprising 65,536 levels lacks.

To those who would claim that Photoshop’s 16-bit color is really more like 15-bit color, we simply point out that it takes 16 bits to represent, and by the time capture devices that can actually capture more than 32,769 levels are at all common, we’ll all have moved on to 32-bit floating point channels rather than 16-bit integer ones.

from: http://www.peachpit.com/articles/article.aspx?p=1709190&seqNum=2

and this:

Quote
Photoshop's internel representation is 0..32768. This gives a midpoint to the range (very useful for blending), and allows for faster math because we can use bit shifts instead of divides.
 
That is not a bug, just a design decision to make 16 bit/channel run faster.
 
A search of the forums will reveal more information about that decision.

from: https://forums.adobe.com/message/3472269

Fair enough.

For giggles, try this experiment.

Open a raw image in your favorite converter and render it to a 16bit image in Photoshop.

Do the following:

1) Add a Levels adjustment layer. Pull the Output White Point (the white slider under the gradient, not the white slider under the histogram in the Levels dialog) from 255 to 1 (or type "1" in the right Output field that originally says 255). This will make the image black.

2) Flatten the layer stack (gulp! look at that histogram!!!).

3) Add a Levels adjustment layer. Pull the white point (not the Output white point) from 255 to 2 (it will only go to 2).

4) Because you can only drag the white point slider to "2", add another Levels adjustment layer above the first levels layer and pull that white point to 128.

5) Stamp or flatten the layer stack.  Refresh the histogram if need be.

Voila! Take a look at the resulting histogram - there are gaps throughout the histogram, but the resulting image looks pretty good compared to the original. What went on in this exercise?

Now, try the same experiment only, after step two, change the document mode from 16bit to 8bit. Then complete steps 3 - 5.

Why is there is difference?

Try the above exercise again by making a blank 16bit document and filing it with a pure white bar, a 50% gray bar and a pure black bar. Also, you can try a black to white gradient. Once you finish step 2 above, use the color sampler and look at the Info palette with the RGB color readout in 8bit mode and then in 16bit mode.

kirk
« Last Edit: December 02, 2014, 11:59:48 pm by kirkt »
Logged

silverimage

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Re: Questions about 0-255 scale
« Reply #4 on: December 03, 2014, 01:02:46 am »

Kirk, this is very interesting, albeit confusing.  I will need to research this a bit more, I think.
But do I understand correctly that this is about how PhotoShop interprets 16-bit files? Or is there not actually 16-bits of information in the TIFF I've output from my RAW converter?
Logged

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Questions about 0-255 scale
« Reply #5 on: December 03, 2014, 12:45:58 pm »

...Or is there not actually 16-bits of information in the TIFF I've output from my RAW converter?

It helps to understand bits if you think about it more as a function of precision over just "data" captured that allows how precise edits are applied to digital data in how it appears when those precise mathematical instructions are mapped to an 8 bit video preview. The more numbers (bits) that are used to guide the math that guides the edits the smoother and more precise the tweaks especially for bringing out shadow detail where there is more noise.

You keep thinking you have something organic and physical captured in the form of a digital image when what you really have is data (in machine language) that can be manipulated through software to make each 0-255 RGB 8 bit pixel preview bring out what you think your camera's sensor recorded.

And what most cameras can record is far more than our eyes can see depending on distance of subject to lens so this "bit" thing is nothing to be concerned over when making a picture that isn't a real physical manifestation.

How much precision do you want your software to sort out real detail from noise. The more bit numbers, the more precise the edits that show up on an 8 bit video preview.
Logged

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 20646
  • Andrew Rodney
    • http://www.digitaldog.net/
Re: Questions about 0-255 scale
« Reply #6 on: December 03, 2014, 01:01:03 pm »

How much precision do you want your software to sort out real detail from noise. .
Exactly. To get the job done, do we need the finer granularity of numbers we can’t even see?
If one examines the histogram in Photoshop, one pixel of the 0-255 values is drawn to produce that preview. Now consider plotting that in 16-bit and how big a display you’d need just to see it. The extra granularity of data IS useful, but seeing it numerically really isn’t.
And then examine CMYK values! Talk about another disconnect.
Logged
http://www.digitaldog.net/
Author "Color Management for Photographers".

Jim Kasson

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2370
    • The Last Word
Re: Questions about 0-255 scale
« Reply #7 on: December 03, 2014, 01:11:50 pm »

from: http://www.peachpit.com/articles/article.aspx?p=1709190&seqNum=2

Quote
Well, that’s certainly one way that a 16-bit channel could be constructed, but it’s not the way Photoshop does it. Photoshop’s implementation of 16 bits per channel uses 32,769 levels, from 0 (black) to 32,768 (white). One advantage of this approach is that it provides an unambiguous midpoint between white and black (useful in imaging operations such as blending modes) that a channel comprising 65,536 levels lacks.

If they decided to do it that way, fine. But why throw away all those codes when they could represent negative numbers in intermediate calculations? We'd have a lot less problems with sharpening causing irrecoverable errors in dark tones, and the subtract blending mode would actually work the way you'd think it should work.

Jim

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Questions about 0-255 scale
« Reply #8 on: December 03, 2014, 01:21:22 pm »

If they decided to do it that way, fine. But why throw away all those codes when they could represent negative numbers in intermediate calculations? We'd have a lot less problems with sharpening causing irrecoverable errors in dark tones, and the subtract blending mode would actually work the way you'd think it should work.

Jim

How did you prove this was happening viewing an 8 bit video preview, Jim?

If you're going to show math was the way you defined and proved this was happening, please make a direct connection how the math created the errors that show up in the preview.
Logged

Jim Kasson

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2370
    • The Last Word
Re: Questions about 0-255 scale
« Reply #9 on: December 03, 2014, 01:54:39 pm »

How did you prove this was happening viewing an 8 bit video preview, Jim?

If you're going to show math was the way you defined and proved this was happening, please make a direct connection how the math created the errors that show up in the preview.

I'm talking about the errors that show up in the file, not the preview.

Jim

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Questions about 0-255 scale
« Reply #10 on: December 03, 2014, 02:04:49 pm »

I'm talking about the errors that show up in the file, not the preview.

Jim

How are the errors defined? Mathematically? Precision by the numbers?

How do you know they're errors?
Logged

silverimage

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Re: Questions about 0-255 scale
« Reply #11 on: December 03, 2014, 02:40:49 pm »

Quote
...Or is there not actually 16-bits of information in the TIFF I've output from my RAW converter?
You keep thinking you have something organic and physical captured in the form of a digital image when what you really have is data (in machine language) that can be manipulated through software to make each 0-255 RGB 8 bit pixel preview bring out what you think your camera's sensor recorded.

Thanks for the replies all. I'm going to mull this over.

Where I get confused: these are digital files, made up of 0s and 1s. In 16-bit (let's say greyscale for ease sake), a given pixel's colour is represented by a string of sixteen 0s and 1, e.g. 0010011110101001. Whatever different softwares do to interpret this, the underlying data should have these sixteen bits ... No?
Logged

Torbjörn Tapani

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 319
Re:
« Reply #12 on: December 03, 2014, 02:48:00 pm »

Note that Lightroom does not show 256 levels but rather 0-100% in .1 increments so 1000 levels. Files could be 8-bit 12,14 bit raw 16 or 32 bit TIFF so a fixed 256 scale would be strange. A raw file is not even RGB yet so it doesn't make sense to show a 8 bit RGB value. But you can do that with soft proofing if you want to.
Logged

EricV

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 270
Re: Questions about 0-255 scale
« Reply #13 on: December 03, 2014, 04:05:07 pm »

15+1 bits can span the range 0-32768 in integer steps.  The same 15+1 bits can also span the range 0-256, with each bit representing a change of 1/128.  When you look at an intensity histogram, the intensity range (X-axis) is binned, with each bin showing how many pixels in the image have intensity within that bin range.  So in our example, if the histogram covered the range 0-256 with (256, 128, 64, 32) bins, each bin would span an intensity range containing (128, 256, 512, 1024) discrete levels.  It would not make sense or be useful to produce a histogram with 32768 bins.
Logged

Jim Kasson

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2370
    • The Last Word
Re: Questions about 0-255 scale
« Reply #14 on: December 03, 2014, 06:20:33 pm »

How are the errors defined? Mathematically? Precision by the numbers?

How do you know they're errors?

Mathematically. You can see it for yourself. Make a 16 bit RGB image and fill it with 32,32,32. Add a layer and fill it with 96,96,96 and set the blend mode to subtract. Add a third layer, fill it with 96,96,96 and set the blend mode to Linear Dodge (add).

It'll look like this:



With all three layers turned on, you'll see 96,96,96, or 12336,12336,12336 if you've decided to look at actual color. You should see the same values as in the bottom layer, since you added and subtracted the sane amount.

Jim
« Last Edit: December 04, 2014, 12:10:38 am by Jim Kasson »
Logged

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: Questions about 0-255 scale
« Reply #15 on: December 03, 2014, 06:56:15 pm »

Where I get confused: these are digital files, made up of 0s and 1s. In 16-bit (let's say greyscale for ease sake), a given pixel's colour is represented by a string of sixteen 0s and 1, e.g. 0010011110101001. Whatever different softwares do to interpret this, the underlying data should have these sixteen bits ... No?

The 16 bits remain, but Photoshop zeroes the LSB (least significant bit), so we can effectively talk about a 15-bit encoding (actually 15-bit plus one level):

16-bit TIFF histogram (at 1:1 scale representing level range 0-511 out of 0-65535):




We open that TIFF into Photoshop and save it back without any further action:




Photoshop stole half the levels from us! wasn't TIFF a lossless format? or is it Photoshop a lossy image editor? ;D

Since the vast majority of PS users even don't know about this it means 15-bit integer clearly suffices any postprocessing needs, at least with gamma encoded images such as the usual ones we deal with in PS when using sRGB, AdobeRGB, ProPhotoRGB,... nonlinear profiles. With the continuous improvement in dynamic range both in capture and display devices (camera sensors and monitor screens), probably a day will come when floating point linear encodings become the standard on image editors though.

Regards


« Last Edit: December 03, 2014, 07:22:51 pm by Guillermo Luijk »
Logged

kirkt

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 604
Re: Questions about 0-255 scale
« Reply #16 on: December 03, 2014, 07:33:34 pm »

The 16 bits remain, but Photoshop zeroes the LSB (least significant bit), so we can effectively talk about a 15-bit encoding (actually 15-bit plus one level):

...
Regards


Hi Guillermo!

kirk
Logged

fdisilvestro

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1853
    • Frank Disilvestro
Re: Questions about 0-255 scale
« Reply #17 on: December 03, 2014, 07:51:09 pm »

A 16-bit binary register can represent 65536 different combinations of bits

The two common integer implementation:

  - Unsigned Integer: 0 <> 65535
  - Signed: -32768 <> 32767 (most implementations)

Photoshop decided to use signed 16 bits integers. Negative numbers cannot represent real images (although I agree they could be used for intermediate calculations) so they are not used and in practical terms you have positive values from 0 to 32767

Quote
Well, that’s certainly one way that a 16-bit channel could be constructed, but it’s not the way Photoshop does it. Photoshop’s implementation of 16 bits per channel uses 32,769 levels, from 0 (black) to 32,768 (white). One advantage of this approach is that it provides an unambiguous midpoint between white and black (useful in imaging operations such as blending modes) that a channel comprising 65,536 levels lacks

I find this statement imprecise (there are no 32769 levels but 32768) and I really do not understand what is the "unambiguous midpoint between white and black". It seems nonsense to me.

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: Questions about 0-255 scale
« Reply #18 on: December 03, 2014, 08:09:12 pm »

Now consider plotting that in 16-bit and how big a display you’d need just to see it. The extra granularity of data IS useful, but seeing it numerically really isn’t.

You can see that here (Fig. 3)!

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: Questions about 0-255 scale
« Reply #19 on: December 03, 2014, 08:39:28 pm »

I find this statement imprecise (there are no 32769 levels but 32768) and I really do not understand what is the "unambiguous midpoint between white and black". It seems nonsense to me.

That is not the way PS works, it uses even numbers from 0 to 32768 and odd numbers from 32769 to 65535 from the entire 16-bit range (0..65535). That makes a total amount of 32769 levels, not 32768. See the 'PHOTOSHOP'S 15-BIT IMAGES' end section in the HISTOGRAMMAR TUTORIAL.

This can be seen when the histogram is scrutinized at 1:1:

« Last Edit: December 03, 2014, 08:47:36 pm by Guillermo Luijk »
Logged
Pages: [1] 2   Go Up