# Thread

# 2002.01.21 17:23 "Re: How to interpret 16-bit GrayScale image?", by Daniel McCoy

Then convert from 16 bps to 8 bps by dividing by 257. (sic, 257. NOT 256)

I've seen this comment a couple of times recently and find it very strange just hanging out there as if it's some gem of image processing wisdom.

When converting the OTHER way, from 8 bits UP to 16 bits, of course, you want to MULTIPLY by 257 and not 256 so that you fill in the low bits. That way FF becomes FFFF instead of FF00. Clearly better. No question. Crazy to do otherwise.

But when converting from 16 bits DOWN to 8 bits, DIVIDING by 257 (hex 101) doesn't make as much sense to me as using 256 (hex 100).

FFFF / 101 = FF ok

FFFE / 101 = FE are you sure you want this?

FEFE / 101 = FE ok

FEFD / 101 = FD are you sure you want this?

...

0101 / 101 = 01 ok

0100 / 101 = 00 are you sure you want this?

00FF / 101 = 00 ok

If you use 256 (hex 100) instead:

FFFF / 100 = FF same as 101

FFFE / 100 = FF seems better to me.

FEFE / 100 = FE same as 101

FEFD / 100 = FE seems better to me.

...

0101 / 100 = 01 same as 101

0100 / 100 = 01 seems better to me.

00FF / 101 = 00 same as 101

Of course, it depends on what use you plan for the data. But for viewing 16 bit greyscale image on 8 bit hardware, I think dividing by 256 (shifting down eight bits) would give a better display.

Another way to describe the difference:

When you divide by 256, then exactly 256 16-bit grey levels translate into each of the 256 possible 8-bit grey levels. Seems like that makes good use of the limited 8-bit display.

If you divide be 257, then 257 grey 16-bit grey levels translate into the lower 255 possible 8-bit grey levels and the single left over 16-bit grey level (FFFF) translates into the single left over 8-bit grey level (FF).

The only way I could see using 257 is if you are adding 128 or 127 to round them up first.

Daniel McCoy