Page 1 of 1

Using transparent on the command line

Posted: 2009-12-05T14:08:21-07:00
by sftriman
I am trying to create square images by making a border on images and then cropping.
Here is the command I've been trying to get to work:

convert original.jpg -bordercolor "#e6a7c8" -transparent "#e6a7c8" -thumbnail 57x57 -gravity center -format jpg -border 60x60 -crop 57x57+0+0 new.jpg

It does everything I want it to do except to change the color #e6a7c8 to clear.
I tried -opaque in conjunction with -fill as well. No go. I also tried doing the
convert above first without the -transparent part, and then a 2nd convert as:

convert -transparent "#e6a7c8" new.jpg new.jpg

but that didn't work either.

I looked into -alpha, but my version of convert doesn't have that. Nor does it
have the -transparent-color option. I also tried setting -background colors.
Setting the color itself to "transparent" makes the color black.

I have this version:

Version: ImageMagick 6.0.7 07/25/08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2004 ImageMagick Studio LLC

Any suggestions on how to get a transparent border color when I create
square images?

Thanks!
David

Re: Using transparent on the command line

Posted: 2009-12-05T15:00:24-07:00
by el_supremo
I'm not clear on what you're trying to achieve but the JPG format does not support transparency.
Try using PNG format for the output.

Pete

Re: Using transparent on the command line

Posted: 2009-12-05T16:03:32-07:00
by fmw42
try this

convert logo: -thumbnail 57x57 -gravity center -background none -extent 57x57 logo_thumb.png

Note: as el_supremo said, jpg does not support transparency on output. So your output must be either png or gif.