Trouble with Color Spaces? How can I set one?

Hello again! :stuck_out_tongue:
I took a background image off a website and I can see it has the correct color when I open it in Photoshop using Monitor RGB as a Color Profile, but when I open it inside an application made using openF the color has been changed slightly, like in the image I’ve attached.

Is there any way to set a Color Space or Profile using openFrameworks or openGL commands?
Are Color Spaces and Color Profiles the same?
Any info is very welcome and thanks again :slight_smile:

this is gonna sound kind of basic, so apologies in advance – are you sure that you are drawing the image without tinting it? when you have a draw color, like:

ofSetColor(220,220,220);

it will tint the image that you draw after. be sure to set the draw color to be white before you draw:

ofSetColor(255,255,255);
img.draw(20,20);

hope that helps!
zach

[quote=“zach, post:2, topic:6954”]
this is gonna sound kind of basic, so apologies in advance – are you sure that you are drawing the image without tinting it? [/quote]

Oh no don’t worry, I’m here to learn. :wink:
The code that I have written has a lot of tinting, so I set everything to comment except the background.draw() line and you were right, but I still have no idea where this small tinting issue appears.

I used this as a fade in for parts:
ofSetColor(225,255,255,fade);
where fade value is clamped between 0 and 255. Should it tint white when fade = 255 exactly like the following?
ofSetColor(225,255,255);

I will recheck all the code tomorrow since it has to be there.
Thank you very much for your time Zach. If I think it is some sort of bug I’ll search the forum or let you guys know.

yeap, I wouldn’t know if it is a bug or anything, but I tried a few different codes and this was the one that worked. I had to change R=255, G=255, B=255, all to variable fade, and fade is clamped betweed 0 and 255;

if (fade < 255) ofSetColor(fade,fade,fade,fade);

when fade= 255 it then stays like ofSetColor(255,255,255), which is confussing since the original one was:

ofSetColor(255, 255, 255, fade);

I also tried an if which should have worked perfectly, but instead I get a weird jump from the colors I mentioned at the beginning of the thread (orange to saturated orange).

Any thoughts? =D

sorry it’s hard to understand from your post what you did. if you want to post a simple example of something that doesn’t look right I’m happy to take a look. please post both the src and the data folder.

Here it is. It has 3 methods for fading. Numbers 1 and 2 were the ones giving me problems. Number 3 works perfectly and the last part is just there to compare number 3 with.
vel_fade value is the velocity of the fade and pressing right click will make a fade out.

Used CodeBlocks 10.05 32bit in Windows 7 x64.
Thank you for your time!

Fade_tests.zip

Hi, number3 works because you are drawing a black background and are tinting the image from black, 0,0,0 to white (no tint). I’m not sure, but number 1 should work as well, when you add ofEnableAlphaBlending() at the beginning of your draw function. Because you are changing the alpha value.
At some point it was enabled by default in of, but I don’t think it is right now…

Thanks for the answer, but ofEnableAlphaBlending() is in the setup(). At some point I tried it in draw() and it didn’t work.

It wouldn’t work in setup. If it did then it has to be here:

  
  
void testApp::draw(){  
   ofEnableAlphaBlending();  
   //draw some stuff with alpha  
   //....  
}  
  

If this doesn’t work as well and you really need an image with transparency, you can also loop through all of the pixels and change the alpha value. You could use ofImage.setColor(int x, int y, ofColor color) for example. But while this is probably the easiest method, it is not the fastest one. And don’t forget to call update after you modified the image.

Well yes I already tried that. In the example I uploaded, method 3 works perfectly, if that one works I don’t see why the others ones don’t since they all arrive at ofSetColor(255,255,255,255). That is the point of the thread but since I now have a working solution I wanted to dig deeper into openF code.

If you look at the source, both Methods 1 and 3 arrive there when fade = 255, but they display differently, both when ofEnableAlphaBlending() exists or not. Already tried it.

Method 1: ofSetColor(225,255,255,fade);
Method 3: ofSetColor(fade,fade,fade,fade);

in your code you have some instances of

ofSetColor(225,255,255)

where it should be 255 not 225… :slight_smile: that’s the color difference.

hope that helps!
zach

Wow, thats totally it… I must be going blind. A big sorry and thank you for your patience. :smiley: