Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Color Transform Problem — Gideros Forum

Color Transform Problem

moopfmoopf Guru
edited September 2013 in General questions
OK, I'm having real issues getting setColorTransform to actually transform a colour accurately. I have an image that, if I show in the app displays a particular blue correctly. Thing is, it's a big block of blue and I have a little fill.png that I stretch and colour for things like this to limit the images used.

If I use the image itself I get the nice bright blue, if I use setColorTransform on the white fill png then I don't, I get an insipid blue. The blue in question is: #69b9ec (R: 105 G: 185 B:236). It's not the only colour I'm having problems with in this way though, but it is really obvious. This is testing in the Gideros player on a mac, although the same issues happen on a device as well.

So, is there something strange about the way setColorTransform works that causes these issues? I can't quite understand why I can't setColorTransform to get exactly the same colour as I would if I embedded the full png. Any suggestions?

Comments

  • ar2rsawseenar2rsawseen Maintainer
    edited September 2013
    theoretically, if the image is white (255, 255, 255), then to set RGB values as 105, 185, 236 you would have to set
    setColorTransform(105/255, 185/255, 236/255)
    or values: (0.41, 0.725, 0.925)

    Doesn't it work as expected?
  • No it doesn't. I've tried it down to lots of decimal places as well:

    setColorTransform(0.411764703,0.725490191,0.92549019,1)

    It's not working as I'd expect at all.
  • atilimatilim Maintainer
    edited September 2013
    On windows, it has worked exactly I've expected:
    local bitmap = Bitmap.new(Texture.new("white.png"))
    bitmap:setColorTransform(0x69/255, 0xb9/255, 0xec/255)
    stage:addChild(bitmap)
    I'm attaching my white.png.

    @moopf can you attach your image while I'm testing on Mac?

    edit: also is there a good color picker for Mac? :)
    white.png
    256 x 256 - 770B

    Likes: Yan

    +1 -1 (+1 / -0 )Share on Facebook
  • When I put your #69b9ec setting into my graphics program it gave a failrly light blue like the one attached. Is that what you are seeing?
    testPng.png
    200 x 200 - 648B
  • atilimatilim Maintainer
    I've used DigitalColor Meter.app on Mac and I'm getting #69b9ec on both Gideros Player and @petec's image.
  • OK, I've been checking some more. This is a limitation of RGB colourspaces I think now I look at it again. What's happening is that the RGBs are identical but, actually, the colours are slightly different when you look at them in CMYK. I've found a way around it which ends up as the RGB I need to use being #00bcea (0,188,234) to get the blue I actually want. Now to convert the other ones.
  • atilimatilim Maintainer
    edited September 2013 Accepted Answer
    Makes sense. Gideros ignores the PNG's attached color profile. If you have ImageMagick installed, you can strip the color profile by using:
    mogrify -strip image.png
    http://www.imagemagick.org/script/command-line-options.php#strip

    Likes: chipster123

    +1 -1 (+1 / -0 )Share on Facebook
  • So Bitmap also supports :setColorTransform()? According to the docs, it doesn't :-O

  • ar2rsawseenar2rsawseen Maintainer
    edited November 2013
    @MauMau Sprite supports setColorTransform()
    Bitmap inherits from Sprite, so everything Sprite supports, Bitmap also supports ;)

    And if you look here, you can also see all inherited methods:
    http://docs.giderosmobile.com/reference/gideros/Bitmap#Bitmap
Sign In or Register to comment.