Jump to content

cutting background from image


Recommended Posts

Hello Paint.NET gurus!

 

I've got two bmp files with white and grey backgrounds (see attach - white background and grey background layers). These pictures were actually made from a single picture (with transparency) and different background colors.

I need to restore the original picture (with transparency). I've played around with alpha mask plugins but with no luck.

Is there a way to make it work?

 

Thanks in advance.

backgrounds.pdn.zip

Link to comment
Share on other sites

I tried to do this earlier, with the magic wand on both layers, each with a different tolerance, but the outcome was awful as the images supplied by @nikini are so very small.  I don't think it's possible with such minute images - but I could be wrong :/ .

  • Upvote 1

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

Thanks all for replies!

 

Actually I've tried "magic wand" on these bmp files (they are 48x48 icons actually) but results look weird.

 

Still I think there must be a technique (plugin or set of plugins) that can do the following:

1. We know that upper left pixel in image is "pure background pixel" - without any influence from "main" picture

2. Create a "mask" image so that each pixel color is "subtracted" from upper left pixel color.

3. Repeat previous steps on second image (with different "upper left pixel" color).

4. Somehow combine two masks and get real alpha mask (for one of initial bitmaps).

5. Apply this mask to one of initial bitmaps and restore original image with transparency

Link to comment
Share on other sites

One thing you should consider is that the images do not seem to have been produced by alpha blending an image against two different background colors. If you alpha blend the same image to two different background colors, the difference between the resulting images will be an essentially constant color, equal, for each BGR component, to (1 - alpha/255) * (background1 - background2). However, if you use difference blending on the two layers, the result is clearly not a single color. I tried this with an actual image, to make sure the difference blending works like I think it would, and the result was a constant color of the predicted shade.

 

Had the images been produced with alpha blending, it would have been fairly easy to recover the original image. As you can see by the above formula, since the background colors are known, the value of alpha could be calculated from the difference of the images. (This part may not be true. Only the blended background color is known. I'll need to think about it some more.)

Edited by MJW
Link to comment
Share on other sites

If you want to make a mask of your object, you can try this :
1) Change the top layer's blending mode to Multiply.

2) Duplicate the top layer, name it Alpha Mask.

3) Duplicate the Alpha Mask layer, then merge that duplicate back down, so that you only have one Alpha Mask layer.
4) Temporarily turn off the other two layers.
5) Use the two-tone threshold plugin on the Alpha Mask layer to turn the object solid black and remove the background.
Try these settings:
Lo threshold 255
Hi threshold 255
Colors 1. black    2. transparent.
Leave the rest of the settings default.
Click Ok.
If some parts of the object are not black, use the paint brush tool for touching things up.
6) If you are successful at making your object into a mask, you can then use the mask with the alpha mask plugin on one of the other layers. (use the invert mask setting).

 

If you need more help or have questions, feel free to ask. :)

Edited by Cc4FuzzyHuggles
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...