Page 1 of 1

Rounded Corners with the Command Line Interface

Posted: 2011-12-20T14:49:19-07:00
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!

Re: Rounded Corners with the Command Line Interface

Posted: 2011-12-20T17:22:07-07:00
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.

Re: Rounded Corners with the Command Line Interface

Posted: 2011-12-20T23:16:16-07:00
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.

Re: Rounded Corners with the Command Line Interface

Posted: 2011-12-29T10:16:47-07:00
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!