1 year ago
#350929
Jean
PNG Pixel Values Slightly Off
For the past few weeks I have been debugging a very weird issue I've been having with pngs. I am building a game where the map is loaded as a png, with each individual pixel representing a specific object depending on its RGB value. What I have noticed is that after opening my map in an editor(all editors have this problem from GIMP to photoshop to online editors) and saving it (even if no changes were made), a handful of seemingly random pixels will have their RGB values shift by a tiny amount. For example an RGB value of 255,255,255 would become 255,255,253. I used png for my map because it is supposed to be a lossless format. For context, I am building my game in C, using the "loadImage" function in the Raylib graphics library. It is specified in the raylib documentation that loadImage works with png files.
I have googled extensively but cannot find any information about this issue. The png compression level used when saving does not seem to make a difference. Has anyone else had this problem, or is this just a weird quirk of the png format?
image
png
raylib
0 Answers
Your Answer