[Solved] rounding edges of QR code squares?

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
User avatar
owntheweb
Posts: 20
Joined: 2011-05-24T06:30:15-07:00
Authentication code: 8675308
Location: Colorado

[Solved] rounding edges of QR code squares?

Post 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
Last edited by owntheweb on 2011-05-24T14:24:50-07:00, edited 1 time in total.
Twitter | Blog | Worlds to explore. Worlds to create.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: rounding edges of QR code squares?

Post 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?
User avatar
owntheweb
Posts: 20
Joined: 2011-05-24T06:30:15-07:00
Authentication code: 8675308
Location: Colorado

Re: rounding edges of QR code squares?

Post 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.
Twitter | Blog | Worlds to explore. Worlds to create.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: rounding edges of QR code squares?

Post 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.
User avatar
owntheweb
Posts: 20
Joined: 2011-05-24T06:30:15-07:00
Authentication code: 8675308
Location: Colorado

Re: rounding edges of QR code squares?

Post 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
Twitter | Blog | Worlds to explore. Worlds to create.
Post Reply