Page 1 of 1

removing one color from pic 1 and merging it with pic 2?

Posted: Wed Feb 08, 2012 11:43 pm
by Bugala
Here is what I am trying to do.

I have two pictures, both in JPG format.

Other picture 1 is a background picture and picture 2 is something similar to blue screen technic. By otherwords, its a picture with white blackground and has the object in middle of it.

What I want to do, is to remove all the white from the picture 2 and then merge it with picture 1, so it would look like that picture 2 object is on that picture 1 background.


What I have achieved so far is following:


I loaded picture 2 (JPG) and saved it as GIF image with 256 Colors.

Then I loaded that just created GIF version of picture 2 and used readpixel to find the while colors number, and then used SetBrushTransparency to remove the White away.

I succeeded well enough in getting that white away (didint get it all off, but enough much anyway).


BUt after this I cant get the rest of the process done.

I have so far tried two methods.


I loaded picture 1 as BGPic and then displayed picture 2 to that BGpic with DiplayBrush() command.

That worked fine and looked right. However, I couldnt figure out a way to actually save what i saw being displayed.


Another thing I tried was to load both picture 1 and GIF version of picture 2 as brushes.

Then I selected picture 1 brush with SelectBrush() method, and used DisplayBrush() command to display that Picture 2 Gif into that picture 1.

After that I saved that brush.

I did succeed in merging them too correctly in sense that bavkground is background and Picture 2 is on top of picture 1. However, It didnt save the transparency, but instead all the white is still in there.



So anyone has any solution how to actually do this?

I would have about 400 pictures that need to be done through this process, so doing it manually with a graphics program is not really an option, and therefore i Thought i do it with Hollywood, but now i dont seem to be able to achieve it.

Re: removing one color from pic 1 and merging it with pic 2?

Posted: Thu Feb 16, 2012 6:00 pm
by airsoftsoftwair
I think you can do this with an alpha channel. Just read the pixels from the source brush and then write them to the destination alpha channel. Write 0 to the alpha channel for an invisible pixel, and 255 for a visible one. Then save the brush as a PNG picture with alpha channel using SaveBrush(). Shouldn't be too much work and can save you a lot of time if you need batch processing.