Issues about setting mask color for jpeg file


I want build a irregular window from the jpeg file ,which contains the mask color(#FF00FF).

How to do this? I find all the api reference document, but sorry for nothing got.

The next is my picture, BackgroudC.jpeg, I wonder how to set the mask color for it?




Convert it to a PNG with an alpha channel, and use that instead.

:<, my god, there are many files needeb be converted. Tough task!!!

Dose the juce has such converting functionality? Maybe it needs the third party tool, e.g, photoshop?

Thanks jules for you so fast reply:)!!!

You could write a little routine to convert it in juce, but the reason why nobody uses mask colours any more is because they look crap, having only a 1-bit alpha. Ideally, you should get the original photoshop files, remove all the masking layers, and re-composite them properly, saving them with an 8-bit alpha channel.


Image* imageMask;

for(int y=1; y<= imageMask->getHeight(); y++)
        for(int x=1; x<= imageMask->getWidth(); x++)
            if (imageMask->getPixelAt(x,y)==Colour(0xFF00FFFF))// 0xFF00FFFF--->color mask
                 imageMask->setPixelAt(x,y,Colour (0x00000000));

Thanks very much. I think I will add a tiny routine to do it.
Thanks yosvaniscc. you sample seems even simple.

:smiley: :smiley: :smiley: