[mojo2] Getting wrong colors rendered
Monkey Forums/Monkey Programming/[mojo2] Getting wrong colors rendered
| ||
Today I noticed there is something off with the colors of my images. I used a color picker and confirmed that the values are not the same as in the actual image.![]() edit: original and ingame should be flipped It would be really helpful if you could tell me if it's the same for you guys. Here is an isolated testcase. Function Main:Int() New ColorsAreWrong Return 0 End Class ColorsAreWrong Extends App Field img:Image Field canvas:Canvas Method OnCreate:Int() canvas = New Canvas img = Image.Load("image.png") img.SetHandle(0, 0) Return 0 End Method OnRender:Int() canvas.Clear() canvas.DrawImage(img) canvas.Flush() Return 0 End End You can use this image: ![]() Value should be: Hex: #33CBB6 RGB: 45,196,174 I tested this on Html5 and Desktop targets. |
| ||
Update: I found out that this does not happen with every image?! The one I provided you with should be fine. So it seems have to save a png the right way ... PS: WOW, so Pixelmator (Mac App) somehow saves pngs in the wrong format when doing it normally. For anyone in the same situation: The workaround is to save via File -> Export (not for web). |
| ||
I expect save for web is using pngcrush and pngquant to minimise file size by reducing palette to less than 256 colors. |
| ||
The problem is that a normal save will also save the wrong format. The images look identical when looked at in an image viewer/editor, just in monkey it messes up. |
| ||
Probably not just in Monkey - since it doesn't implement a PNG loader from scratch or anything - it will happen with a lot of other programs too. |