How do I make background transparent?

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
c5c5

How do I make background transparent?

Post by c5c5 »

Greetings,

I have a gif image that I would like to make the white bg transparent. How do I do this in Image Majick?

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

Re: How do I make background transparent?

Post by fmw42 »

convert input.gif -transparent white output.gif

assuming the background is pure 100% white
c5c5

Re: How do I make background transparent?

Post by c5c5 »

Thank you. I will see if it works.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How do I make background transparent?

Post by anthony »

For more difficult background to transparency conversions..
Transparency Masking an Image
http://imagemagick.org/Usage/channels/#mask_creation
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Oleg

Re: How do I make background transparent?

Post by Oleg »

fmw42 wrote:convert input.gif -transparent white output.gif

assuming the background is pure 100% white
I have this error when running this command :

Image

What is the matter?

May be I have installed a wrong version of ImageMagick ? :?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How do I make background transparent?

Post by Bonzo »

Can not read Russian but assume that the problem is that the convert.exe that is being used is the one built into Windows not IM the convert.exe

I think the work around is to rename the IM convert.exe to somethng like IM_convert.exe and use IM_convert instead of convert in your camand. I wonder if you could add the path to the IM convert comand e.g. c:/program files/imagemagick folder/convert
Oleg

Re: How do I make background transparent?

Post by Oleg »

Bonzo wrote:Can not read Russian
I can translate (from Russian) texts into my error window (above) :

Window title : "Application error".

Text after red cross : "Application initialization error (0xc0150002). Press OK to close application".
Bonzo wrote:but assume that the problem is that the convert.exe that is being used is the one built into Windows not IM the convert.exe
No, it is not.

I run my command (convert.exe with parameters) from "Far manager" (a file manager like Norton commander) in curent folder C:\ImageMagick>
Post Reply