rgb2bgr16

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 4.4, Creation date: 2018-11-28, Last change: 2025-09-14

converts a RGB 3 x 8 Bit color into a BGR 3 x 5 + 1 Bit = 16 Bit Value for STL attribute by color values

Description

Used for WRITING COLORED STL FILES
Support of VisCAM and SolidView Colors as attribute by Byte
bits 1 to 5 are the intensity level for blue (0 to 31),
bits 6 to 10 are the intensity level for green (0 to 31),
bits 11 to 15 are the intensity level for red (0 to 31),
bit 16 is 1 if ONE color is used, or 0 if the faces color are used.
SG-Lib 4.7 with support of Yannick Krieger

See Also: SGwriteSTL , SGwriteVRML , char2rgb , rgb2char , bgr162rgb

Example Illustration

 missing image of rgb2bgr16(RGB)

Syntax

bgr16=rgb2bgr16(RGB)

Input Parameter

RGB: [0..255 0..255 0.255] or 'r', 'y', 'b' etc.

Output Parameter

bgr16: Attribute by Count Value 16 Bit

Examples


a=rgb2bgr16('m'), b=bgr162rgb(a), rgb2char(b*255)
a=rgb2bgr16([255 0 0]), b=bgr162rgb(a), rgb2char(b*255)
a=rgb2bgr16([0.1 0.9 1.0])




Copyright 2018-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Last html export of this page out of FM database by TL: 2025-09-21