...

View Full Version : Is It Possible to Remove Background From Images?



Scriptet
10-31-2009, 02:59 PM
Hi, Is it possible to remove the background of my image and make it transparent using PHP?

For example my image is a .jpg with a white background, I need the white gone.

We need to be able to distinguish the background from the actual image itself, I know PHP is capable of great things, but is it capable of this?

If removing the white and making it transparent isn't possible, can we change the background colour from white to say black?

Again the problem is more distinguishing the background from the image itself I guess..

Jazz914
10-31-2009, 03:08 PM
I don't think it would be possible with a jpg? But i'm not sure about that.

I know you can create png images with transparent backgrounds
And I know PHP can create images with transparent backgrounds,
I'm just not sure about this, but it seems to me if it can do the above it should be able to do that

Phil Jackson
10-31-2009, 03:09 PM
not sure, not a GD man, there are a few members who are great with this kinda thing. Maybe worth going to php.net and checking out the GD manual.

oesxyl
10-31-2009, 05:42 PM
Hi, Is it possible to remove the background of my image and make it transparent using PHP?

For example my image is a .jpg with a white background, I need the white gone.

We need to be able to distinguish the background from the actual image itself, I know PHP is capable of great things, but is it capable of this?

If removing the white and making it transparent isn't possible, can we change the background colour from white to say black?

Again the problem is more distinguishing the background from the image itself I guess..
that don't depend of language, :) the main problem is to decide when something is a background things and when not, :)
if you base the decison of frecvency of each color some time will work sometimes not and I'm sure the results will have low quality.
The problem with removing a color, white as you said, and make it transparent is easy and can be done but don't work for any image format.

best regards

Scriptet
11-02-2009, 02:16 PM
Hm I did get round to testing this but things were poor quality, and I found no way of distinguishing white in the background from white in the actual image.

The only logic I can think of to make this work, is if it works from the outer edge of the image, changes the white pixels into transparent pixels, and then the first time it spots a different colour, stop.

But I don't think there's any way it's going to be done with reasonable quality.

Anyway not to worry!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum