Page 1 of 1

[Solved] rounding edges of QR code squares?

Posted: 2011-05-24T06:48:12-07:00
by owntheweb
Hello,
I've had success creating a cool vanity QR code with rounded edges for my organization by generating a standard QR code, then applying a noise -> median effect in Photoshop to get the edges rounded among some other effects.

Image

Photoshop is great, but I want to automate this. I found a great PHP library to generate QR codes. The part I don't get is the rounding of the hard edges.

I've seen other sites do it like this one.

Any thoughts on how to do this with ImageMagick+PHP? While familiar with GD, I just started playing with ImageMagick. It's like I'm drinking from a fire hose of possibilities right now! I'm reading this page and something with morpholigy looks potential. Newbie guidance is welcome. :)

Best regards,

Chris

Re: rounding edges of QR code squares?

Posted: 2011-05-24T11:12:51-07:00
by fmw42
this is just a quick test:

Image

convert 5754322905.GIF -morphology close disk:3 5754322905_close_disk3.gif

Image


Can you provide links to how you generate your basic qr codes?

Re: rounding edges of QR code squares?

Posted: 2011-05-24T13:22:36-07:00
by owntheweb
Cool! Thanks for the prompt, helpful response. At the moment I've been creating QR codes at http://qrcode.kaywa.com/ at XL size, then doubling the size in Photoshop (while keeping sharp edges) before applying the median effect.

I'm taking a quick ImageMagick/PHP tutorial now and will respond with some samples if you don't beat me to it.

EDIT:

It looks like Imagick is the interface API I have access to. I'm reading up on all the functions and how to convert command lines into function calls.

Re: rounding edges of QR code squares?

Posted: 2011-05-24T14:11:18-07:00
by Bonzo
You might be restricted with what Imagick can do; if so try with php exec( ) and the comand line. Some examples on my site.

Re: rounding edges of QR code squares?

Posted: 2011-05-24T14:23:49-07:00
by owntheweb
I got it! Much more fun to be had, but here's what I have:

Code: Select all

<?php

$im = new Imagick("starter.png");
$height = $im->getImageHeight();
$width = $im->getImageWidth(); 
$im->resizeImage($width * 2, $height * 2, Imagick::FILTER_POINT, 0); 
$im->medianFilterImage(8);

header("Content-Type: image/png");
echo $im;

?>
Result:

Image

I'm covered now. Thanks for the helpful info as I make steps forward on this. :D