Page 1 of 1
Make Simple Background Transparent
Posted: 2016-08-24T08:45:20-07:00
by Larsenv
Using a Mac with ImageMagick 6.9.1-10, how can I remove this background and make it transparent?
Thanks.
Re: Make Simple Background Transparent
Posted: 2016-08-24T09:46:33-07:00
by fmw42
What is background? Is it just the color outside the darker brown region or is it everything but the sofa/chair? Either way, it will be very hard, since the chair color is similare to the rest of the image. If you have a picture that is the same but without the chair, then you can try subtracting that from the image. Otherwise, you will have to manually draw a black/white mask and use that to make the background transparent using
Code: Select all
convert Modwoosof.jpeg mask -alpha off -compose copy_opacity -composite result.png
Re: Make Simple Background Transparent
Posted: 2016-08-24T10:14:35-07:00
by Bonzo
If it is the area outside the brown region could you add a border the same colour, floodfill ( can you floofill transparent? ) and then crop or shave back to the original?
Re: Make Simple Background Transparent
Posted: 2016-08-24T10:31:43-07:00
by snibgo
The answer is easy: do it in Gimp.
I'm serious. IM is not the right tool for this job.
But perhaps there is something the OP hasn't said. Perhaps there are 1000 images, all with the same background, which is to be removed. Or something.
Re: Make Simple Background Transparent
Posted: 2016-08-24T14:06:29-07:00
by Larsenv
snibgo wrote:But perhaps there is something the OP hasn't said. Perhaps there are 1000 images, all with the same background, which is to be removed. Or something.
No joke, there are thousands of these.
The problem is that making them transparent in Photoshop or GIMP for these would be very tedious
The background's the orange thing.
Is there a way to make that actually go away or not?
Re: Make Simple Background Transparent
Posted: 2016-08-24T15:27:53-07:00
by fmw42
If the brown "ring" goes all the way round inside the image boundary, then you can do what bonzo suggested. Add the same background color to a border of at least one pixel wide, then make that color transparent.
Assuming that the upper left corner pixel is always your background color, then this works.
Code: Select all
bgcolor=`convert 8m3q3jS.jpg -format "%[pixel:u.p{0,0}]" info:`
convert 8m3q3jS.jpg -bordercolor $bgcolor -border 1 \
-fuzz 10% -fill none -draw "matte 0,0 floodfill" -shave 1x1 8m3q3jS_trans.png
The -fuzz 10% is needed, since you have a jpg input and the jpg compression makes the background not a constant color, but slightly off in blocks.
Re: Make Simple Background Transparent
Posted: 2016-08-24T18:35:16-07:00
by snibgo
These two images seem to have the same background. Are they the same size? Then find a set of images such that at every pixel is the background on at least one image. Then you can make an image that is entirely background. Then, for every image, were a pixel isn't background, it's a foreground pixel.
I hope your files aren't jpeg. If they are, you'll need fuzz and probably noise-reduction.