I added a couple of comfortablity methods to the Imagick extension. The first one is Imagick::cropThumbnailImage which can be used to create fixed size thumbnails from any image geometry.
The second one was Imagick::roundCorners. It was a little tricky to implement but after staying up all night banging my head to the wall I finally succeeded. It's now possible to create round corners with ease:
#1 by Andy on October 11, 2007 - 2:10 am
Quote
I’m trying to use this with a gif image – but when I round the corners, the background showing is black – any idea how I can change the background color?
#2 by Colnector on October 15, 2008 - 4:00 pm
Quote
This is really nice but simply does NOT work (the corners are not being rounded).
This is the version I’m using of Imagick (over PHP5.2.5 / Apache2) :
imagick module version 2.2.1-dev
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version ImageMagick 6.3.3 04/21/07 Q16 http://www.imagemagick.org
ImageMagick copyright Copyright (C) 1999-2007 ImageMagick Studio LLC
ImageMagick release date 04/21/07
ImageMagick Number of supported formats: 164
#3 by quan on January 7, 2009 - 10:56 am
Quote
It doesn’t work. I’v tried many times, no errors occurs.
imagick module version 2.2.0b2-dev
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version ImageMagick 6.4.1 05/16/08 Q16 http://www.imagemagick.org
ImageMagick copyright Copyright (C) 1999-2008 ImageMagick Studio LLC
ImageMagick release date 05/16/08
ImageMagick Number of supported formats: 185
#4 by Sanjay on June 10, 2009 - 9:05 am
Quote
I’ve been using this just fine in the Imagick extension and I thank you very much for implementing this. I was wondering what commands to use to replicate this function using ImageMagick from the command line, if possible.
Sorry for replying so late after your initial post.
Pingback: Imagick blog » Blog Archive » Imagick new features / An example of Imagick::roundCorners
#5 by Jason Maletsky on March 14, 2010 - 9:15 pm
Quote
Change the output to PNG. That will eliminate any background color.
$im = new Imagick(‘test.jpg’);
$im->setimageformat(‘png’);
$im->thumbnailimage(100, 50, true);
$im->roundCorners(1, 1, 7);
header(‘Content-Type: image/png’);
echo $im;
#6 by Zlati on April 16, 2010 - 5:47 pm
Quote
roundCorners just won’t work, i’ve tried everything, getFormat is also not working
i have messing arround with different version of imagemagic program and dll
i’m with php 5.2.9, in phpinfo it says that the library is loaded, but it show a version of IImageMagick 6.4.1 05/16/08 Q16, imagick module version 2.2.1-dev as above, i’ve found that version and installed it, i copied the two dll in ext folder, first tried with ..dyn.dll cause i downloaded this version, nothing happend , then i comment the dyn.dll and add the st.dll
and it works….
this is very strange for me, that some of function are working and some not.
tried the first tutorial from here http://www.php.net/manual/en/imagick.setup.php – unsuccesfull same issue with the dll
http://image_magick.veidrodis.com/image_magick/binaries/ – tried with
ImageMagick-6.5.4-6-Q16-windows-dll.exe
ImageMagick-6.4.1-10-Q16-windows-dll.exe
ImageMagick-6.5.8-7-Q16-windows-dll.exe
is it possible that the dlls are with wrong names so the static is dyn actually?
http://valokuva.org/outside-blog-content/imagick-windows-builds/080709/
please help to fix this
#7 by Mikko Koppanen on April 16, 2010 - 6:03 pm
Quote
Zlati,
“does not work” is not and never will be a proper description of an error. It tells absolutely nothing about what is the expected and the actual result. As for the getFormat you probably want getImageFormat.
#8 by Zlati on April 16, 2010 - 10:56 pm
Quote
roundCorners returns true, but no change in the image when i print it.
getFormat is from here
http://php.net/manual/en/function.imagick-getformat.php
Returns the format of the Imagick object. – not sure what should return as string
http://bg.php.net/manual/en/function.imagick-getimageformat.php
Returns the format of a particular image in a sequence. – returns only png,jpg,gif etc not the mimetype – image/png, image/jpg etc
#9 by Mikko Koppanen on April 17, 2010 - 1:40 am
Quote
Zlati,
can you put the code somewhere?
#10 by Zlati on April 17, 2010 - 5:11 pm
Quote
No, my host is without imageMagic, i can paste you only the code
$img = new Imagick( ‘images/Sunset.jpg’ );
$img->setimageformat(‘png’);
$img->thumbnailImage(500, 0);
$img->roundCorners( 10, 10 );
$format = $img->getImageFormat();
header( “Content-Type: image/”.$format );
echo $img;
here is the part that show the imagick is loaded, i tried also with magickwand, but there is not sufficient documentation for php
imagick
imagick module enabled
imagick module version 2.2.1-dev
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version ImageMagick 6.4.1 05/16/08 Q16 http://www.imagemagick.org
ImageMagick copyright Copyright (C) 1999-2008 ImageMagick Studio LLC
ImageMagick release date 05/16/08
ImageMagick Number of supported formats: 185
ImageMagick Supported formats A, AI, ART, ARW, AVI, AVS, B, BIE, BMP, BMP2, BMP3, C, CAPTION, CIN, CIP, CLIP, CLIPBOARD, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DNG, DPS, DPX, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, FAX, FITS, FRACTAL, FTS, G, G3, GIF, GIF87, GRADIENT, GRAY, HISTOGRAM, HTM, HTML, ICB, ICO, ICON, INFO, IPL, JBG, JBIG, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, MAP, MAT, MATTE, MIFF, MNG, MONO, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSD, PTIF, PWP, R, RAF, RAS, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WMFWIN32, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YCbCr, YCbCrA, YUV
#11 by Zlati on April 17, 2010 - 5:13 pm
Quote
my bad there is a documenattion for magickwand but there is no function for rounding corners
http://www.magickwand.org/