removing background

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
yllawwally
Posts: 1
Joined: 2019-05-23T15:23:03-07:00
Authentication code: 1152

removing background

Post by yllawwally » 2019-05-23T15:30:51-07:00

Hello,
I'm trying to use convert to remove the background of my images. I have a folder of images. However, I have not been able to get this to work. How do I change the background color to black and set it to transparent. The colors of the background are very similar, but not identical. I'm running version 7.0.8-45, on a windows 7 machine, from the command line. The images are 180x180 png images. The edge all around the image is the background color, and the non-background part does not share the gray color of the background.

User avatar
fmw42
Posts: 25384
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: removing background

Post by fmw42 » 2019-05-23T16:29:29-07:00

It is very hard to know what to tell you without seeing your images. Post them to some free hosting service and put the URL here.

Typical command is

Code: Select all

convert image -fuzz XX% -transparent black output
if the background is near black, where XX% is the percent tolerance near black. Replace black with whatever your background color is.

_______________________

Please, always provide your IM version and platform when asking questions, since syntax may differ.

Also provide your exact command line and your images, if possible.


If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli

Post Reply