Transparent Backgrounds and Frames

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
tdan

Transparent Backgrounds and Frames

Post by tdan »

This is a bit of a newbie question - but I have looked around for the answer to no avail.
I can't get things to show up transparent.

I want to create a frame surrounding a transparent background:

Code: Select all

convert -size 100x100 xc:none -background none -mattecolor red -frame 20x20+5+5 rect.png
And a background surrounded by a transparent frame:

Code: Select all

convert -size 100x100 xc:orange -frame 5x5 -mattecolor none frame.png
What am I doing wrong?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

You did not use the bible... the IM Examples (Cutting and Bordering)

Frame does not use background, it uses bordercolor! background is used for a seperate purpose as part of "montage"

And in your second example you want to use -bordercolor and -border, not -mattecolor and -frame. PS: always set the settings, before the operator that uses them!!!!

Code: Select all

 convert -size 100x100 xc:none -bordercolor none -mattecolor red -frame 20x20+5+5 rect.png

Code: Select all

convert -size 100x100 xc:orange -bordercolor none -border 5  frame.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
tdan

Post by tdan »

That makes sense - thanks so much.

By the way - I do read your IM Examples very frequently. Stellar job!
Somehow I missed that paragraph about -bordercolor applying to the background of frames.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Transparent Backgrounds and Frames

Post by anthony »

Note IM examples is now on the offical IM website -- update you links.
The old site will redirect you.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply