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: 267
Joined: 2005-03-08T22:16:37-07:00

IM 7 -background transparent

Post by dognose » 2019-10-08T07:20:06-07:00

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: 12424
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: IM 7 -background transparent

Post by snibgo » 2019-10-08T07:42:49-07:00

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: 267
Joined: 2005-03-08T22:16:37-07:00

Re: IM 7 -background transparent

Post by dognose » 2019-10-08T08:23:40-07:00

Ok, that works, but it's weird that in other places I use -background transparent it works without -set alpha!?

snibgo
Posts: 12424
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: IM 7 -background transparent

Post by snibgo » 2019-10-08T08:27:21-07:00

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: 267
Joined: 2005-03-08T22:16:37-07:00

Re: IM 7 -background transparent

Post by dognose » 2019-10-08T09:19:13-07:00

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