Rounded Corners with the Command Line Interface

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
MarkTraceur
Posts: 2
Joined: 2011-12-20T14:45:32-07:00
Authentication code: 8675308

Rounded Corners with the Command Line Interface

Post by MarkTraceur »

Hi!

I'm using ImageMagick with the following syntax:

convert [FILENAME] -morphology close disk:[WIDTH OF IMAGE / 100]
[FILENAME]

All it's doing is taking a QR code and rounding off the edges of the
little squares.

My problem comes when the QR code's background is transparent. Observe:

http://qrustom.com:5000/customize.png?f ... 5744e89e1e

The transparency turns black, as opposed to transparent, because the
alpha channel disappears for some reason. Of course, this isn't
ideal....I've been hunting through the documentation trying to find a
way to get morphology to accept transparent as a background color, but
none of the options I've tried are working--'-transparent #00000000',
'-alpha set', '-channel RGBA' are all failing me.

Does anyone have an idea of how to get morphology to work or, if I'm
doing things all wrong, how to round the corners without boffing the
alpha channel?

Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rounded Corners with the Command Line Interface

Post by fmw42 »

I am not sure of what your problem is. Can you show some before and after images? The link you have posted does not work.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Rounded Corners with the Command Line Interface

Post by anthony »

If you are wanting the morphology to handle a the transparency channel of the image only then see...
http://www.imagemagick.org/Usage/morphology/#channel

Also note that if you save a image with transparency to something like JPEG you will lose that transparency as JPG does not understand it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
MarkTraceur
Posts: 2
Joined: 2011-12-20T14:45:32-07:00
Authentication code: 8675308

Re: Rounded Corners with the Command Line Interface

Post by MarkTraceur »

OK, I think I know what was happening--the alpha channel was obviously not being cared for, but I don't think any options were helping that.

I wound up writing my own code for rounding the corners, which looks nicer anyway. Thanks, though!
Post Reply