Using 'display' to show a png with transparent background.
Posted: 2009-03-29T06:13:25-07:00
Hi,
I'm not too experienced with IM, and am having trouble getting the display command to do what I want. I've searched the forum here, but haven't found anything that directly applies to what I'm looking for.
I have a .png file - an icon. It has a transparent background, and I want it to display with the transparency intact, as opposed to a solid-black or checkerboard background. I'm structuring my command as such:
I've tried using other operators under the -alpha switch. Neither Transparent nor Opaque are recognized as valid, which may be due to the somewhat outdated version of IM that's available in the Ubuntu 8.04 repositories. (I'm compiling the latest source as I write this.) How can I get the transparent areas of a file - be it .png or whatever - to actually be transparent when displayed via the display command?
For a second problem, the image displayed in that manner will have a light-gray border around it. I can change the color to any color name available as described under the -fill command (except for 'none' or 'transparent' both of these options cause errors; unrecognized option/file not found, or some such thing). I've tried surrounding the name in quotes, I've tried using the rgba values '(00 00 00 0.0)' - everything I try there also causes errors.
While the command
causes errors, even when "transparent" is changed to "none", the command
will work correctly, and any color name shown on the -fill command page will work as well.
Why can't I get transparency to work at all? I assume it's something I'm doing wrong in my command structure, but can't quite figure it out. After spending a couple of days pouring through man pages and command definitions, everything starts to look the same and I'm finding myself working in circles, trying the same things again and again.
For the record, I'm using Ubuntu 8.04, current on all updates, and my terminal tells me this about my installed version of IM
Thanks in advance for any help.
I'm not too experienced with IM, and am having trouble getting the display command to do what I want. I've searched the forum here, but haven't found anything that directly applies to what I'm looking for.
I have a .png file - an icon. It has a transparent background, and I want it to display with the transparency intact, as opposed to a solid-black or checkerboard background. I'm structuring my command as such:
Code: Select all
display -alpha on -resize WWxHH -geometry +XXX+YYY FILENAME.png
For a second problem, the image displayed in that manner will have a light-gray border around it. I can change the color to any color name available as described under the -fill command (except for 'none' or 'transparent' both of these options cause errors; unrecognized option/file not found, or some such thing). I've tried surrounding the name in quotes, I've tried using the rgba values '(00 00 00 0.0)' - everything I try there also causes errors.
While the command
Code: Select all
display -bordercolor "transparent" -alpha on -resize WWxHH -geometry +XXX+YYY FILENAME.png
Code: Select all
display -bordercolor "peachpuff" -alpha on -resize WWxHH -geometry +XXX+YYY FILENAME.png
Why can't I get transparency to work at all? I assume it's something I'm doing wrong in my command structure, but can't quite figure it out. After spending a couple of days pouring through man pages and command definitions, everything starts to look the same and I'm finding myself working in circles, trying the same things again and again.
For the record, I'm using Ubuntu 8.04, current on all updates, and my terminal tells me this about my installed version of IM
Code: Select all
~$ display --version
Version: ImageMagick 6.3.7 02/19/08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC