Post Reply 
Python issue with implicit data types
08-02-2024, 04:13 PM (This post was last modified: 08-02-2024 04:15 PM by Albert Chan.)
Post: #5
RE: Python issue with implicit data types
Hi, 34C

col = (R*256 + G)*256 + B

Formula is to pack color fields into 1 number, with R,G,B as integers, 0 to 255
If variables have fractional parts, it will mess up the combined packed color value.

Your fix is really the correct formula, may not be Python type issue at all.

col = (int(R)*256 + int(G))*256 + int(B)

To confirm, add 1 more statement, and see if colors changed

col = float(col)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Python issue with implicit data types - Albert Chan - 08-02-2024 04:13 PM



User(s) browsing this thread: 5 Guest(s)