IM 7 -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
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

IM 7 -background transparent

Post by dognose »

Was using this in IM 6

How do i get a transparent background?

flower.jpg
Image

convert flower.jpg -background transparent -shear 12x0 png:output.png

im 6.7.2
Image

img 7.0.8
Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: IM 7 -background transparent

Post by snibgo »

You need to enable alpha:

Code: Select all

magick flower.jpg -alpha set -background transparent -shear 12x0 out.png
snibgo's IM pages: im.snibgo.com
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Re: IM 7 -background transparent

Post by dognose »

Ok, that works, but it's weird that in other places I use -background transparent it works without -set alpha!?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: IM 7 -background transparent

Post by snibgo »

I suppose in those other cases alpha is already enabled. If the input image has any transparency, alpha will certainly be enabled.
snibgo's IM pages: im.snibgo.com
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Re: IM 7 -background transparent

Post by dognose »

for example

convert flower.jpg -background transparent -rotate 45 out.png

will have a transparent background

you'd think setting a color to transparent would enable alpha.. or some consistency.

Anyway thanks for tip!
Post Reply