Jump to content
Sign in to follow this  
Patrick Winkler

Convert 8 Bit RGB to 16 Bit

Recommended Posts


I need to convert from 8 bit RGB to 16 bit.

Just miltipling every value by 256 will come close but not exact:

RGB_8Bit = (255,0,160)

RGB_16Bit = []

for i in RGB_8Bit:

RGB_16Bit.append ( i * 256 )

can someone provide a better algorithm

Edited by Patrick Winkler

Share this post

Link to post


that seems to come closer but is still not exact:

r8bit = 0

print ( ((r8bit + 1) * 256) - 1 )

>> 255 // Should be 0

Edited by Patrick Winkler

Share this post

Link to post

16bitColor = 8bitColor * 257

And conversely,

8bitColor = 16bitColor / 257

0 <-> 0

255 <-> 65535

values in between are evenly distributed between the two end values.


Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...