RGB to hex and hex to RGB

Note: both versions of rgbToHex expect integer values for r, g and b, so you’ll need to do your own rounding if you have non-integer values. The following will do to the RGB to hex conversion and add any required zero padding: Converting the other way: Finally, an alternative version of rgbToHex(), as discussed in @casablanca’s answer and suggested in the comments by @cwolves: … Read more

Generate random colors (RGB)

Here: The result is either red, green or blue. The method is not applicable to other sets of colors though, where you’d have to build a list of all the colors you want to choose from and then use random.choice to pick one at random.

libpng warning: iCCP: known incorrect sRGB profile

Libpng-1.6 is more stringent about checking ICC profiles than previous versions. You can ignore the warning. To get rid of it, remove the iCCP chunk from the PNG image. Some applications treat warnings as errors; if you are using such an application you do have to remove the chunk. You can do that with any … Read more

libpng warning: iCCP: known incorrect sRGB profile

Libpng-1.6 is more stringent about checking ICC profiles than previous versions. You can ignore the warning. To get rid of it, remove the iCCP chunk from the PNG image. Some applications treat warnings as errors; if you are using such an application you do have to remove the chunk. You can do that with any … Read more