Page 1 of 1

IM 7 -background transparent

Posted: 2019-10-08T07:20:06-07:00
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

Re: IM 7 -background transparent

Posted: 2019-10-08T07:42:49-07:00
by snibgo
You need to enable alpha:

Code: Select all

magick flower.jpg -alpha set -background transparent -shear 12x0 out.png

Re: IM 7 -background transparent

Posted: 2019-10-08T08:23:40-07:00
by dognose
Ok, that works, but it's weird that in other places I use -background transparent it works without -set alpha!?

Re: IM 7 -background transparent

Posted: 2019-10-08T08:27:21-07:00
by snibgo
I suppose in those other cases alpha is already enabled. If the input image has any transparency, alpha will certainly be enabled.

Re: IM 7 -background transparent

Posted: 2019-10-08T09:19:13-07:00
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!