I am one of the lead developers in PECL/Imagick PHP extension and a few other PHP extensions. I currently live in London and work for Ibuildings.
Here is my wishlist:
http://www.amazon.co.uk/gp/registry/2T42CBFVKBA9O
I really appreciate all donations.
#1 by Samurai on March 25, 2009 - 11:32 pm
Quote
Can someone please post some examples of how to get Imagick compression working? I try using setImageCompression with all sorts of numbers from 5 up to 100 and I get no difference in the file size of the image.
#2 by Axeia on April 3, 2009 - 1:44 am
Quote
Hello Mikko,
I’m really pleased with the things I managed to do so far with the Imagick class as the graphics look much smoother than what GD2 comes up with.. however I am unable to draw an arc to be used for a pie slice.
(Well actually it’s more of a radarchart, but a bit different).
I tried to use the Imagick::Arc function, but it doesn’t create a slice, so I assume I would need to use pathellipticarcabsolute or pathellipticarcrelative.
So I’d like to request a quick writeup on how to draw a ‘pieslice’. Was asked before in one of the comments on an article by someone else as well, so there’s a least 2 people interested in it.
In case you don’t have the time to write an article about it, could you tell me what’s wrong with this attempt?
$width = 200;
$height = 100;
$img = new Imagick();
$img->newImage( $width, $height, new ImagickPixel( ‘orange’ ) );
$draw = new ImagickDraw();
$draw->setStrokeColor( new ImagickPixel( ‘black’ ) );
$draw->setStrokeWidth( 2 );
$draw->setFillColor( new ImagickPixel( ‘lime’ ) );
$draw->pathEllipticArcAbsolute( $width/2, $height/2, 0, true, false, 0, 30 );
$img->drawImage( $draw );
$img->setImageFormat( “png” );
header( “Content-Type: image/png” );
echo $img;
But it throws a
“Fatal error: Uncaught exception ‘ImagickException’ with message ‘Non-conforming drawing primitive definition `A100” in /srv/www/htdocs/fetish/index.php:556 Stack trace: #0 /srv/www/htdocs/fetish/index.php(556): Imagick->drawimage(Object(ImagickDraw)) #1 {main} thrown in /srv/www/htdocs/fetish/index.php on line 556″
#3 by Delwing on April 13, 2009 - 7:01 pm
Quote
Hi,
Imagick is really great! Too bad that there is not much documentation and examples.
For example I have no idea how to use… Imagick::appendImages, beacuse i would like to add to images small black bars with url on the bottom. Of course I tried with making bigger image and compositeImages, but it is relatively slow for big images – I can see them loadin
#4 by Velin on May 4, 2009 - 7:32 pm
Quote
Hi,
thanks for the great tools and tutorials Mikko.
I have however run into an odd problem where simple Imagick functions fail, which I hope someone else may have stumbled upon and can help me locate.
For example: A simple function which crops a thumb, rounds the corners and writes a new image, will always crop the thumb and write the image, but only once in a while produce the rounded corners.
The problem occurs with a lot of different functions. roundCorners() hardly ever works; no errors, just square corners. All while other functions never causes problems, such as setImageFormat, cropThumbnailImage and writeImage.
Any thoughts on what might produce such a problem?
#5 by Taylor on May 27, 2009 - 10:59 pm
Quote
Great help on your website! I wouldn’t have been able to put my imagick scripts together without these tips.
#6 by Water on July 10, 2009 - 1:05 pm
Quote
Hi Mikko,
Would really appreciate if you can suggest which function is for return a grayscale image (i.e. drop all RGB colors, or cover to pure 256LEVEL black/white).
Tried search manual online, only Imagick::embossImage — Returns a grayscale image with a three-dimensional effect is relative, but with additional 3D effect embedded.
Just want pure flat plain one.
Thanks,
Water
#7 by Mikko Koppanen on July 10, 2009 - 4:02 pm
Quote
@Water,
have you tried Imagick::setImageColorspace and using the gray colorspace?
#8 by Jayce on July 22, 2009 - 1:37 am
Quote
Hi Mikko,
I’m new to Imagick and I have to say it is an awesome extension. I’m looking for a way to use the gravity setting for an image crop. For example, I can do this in IM from the command line:
-gravity Center -crop 410×120+0+0
Is this possilble in Imagick?
Thanks,
J
#9 by Christian on July 24, 2009 - 12:07 pm
Quote
Dear Mikko,
i’ve trying to convert my “psvg” file into an gif or png, to make it visible in IE.
(here is the psvg-file: http://ragesoft.de/index.php?option=com_content&task=view&id=77&Itemid=50)
But i didn’t even get a normal svg-file convertet to a png or gif.
I used the static imagick.dll (php_imagick_5_2_4_Q8_st.dll).
Normal functions (like thumbnail) work fine with png. but when i try to load an svg-file with: $image = new Imagick(“mytestfile.svg”);
i got this error:
Fatal error: Uncaught exception ‘ImagickException’ with message ‘NoDecodeDelegateForThisImageFormat
Why that? How can i easy convert my svg to png…. would be nice if u can answer via email. 1000 thx!!!
#10 by Serhey Dolgushev on July 27, 2009 - 12:54 pm
Quote
Hi Mikko,
Please say why the Imagick::setImageVirtualPixelMethod method is DEPRECATED. Can i somelike set Background virtual pixels method without using it?
Thanks.
#11 by Mikko Koppanen on July 27, 2009 - 1:10 pm
Quote
Serhey,
it looks like it has been undeprecated in ImageMagick. I’ll fix that in Imagick
#12 by Alan on July 27, 2009 - 7:53 pm
Quote
Is there any way to alter color channels using Magick (php version). I know how to do it with the commandline tool.
#13 by Serhey Dolgushev on July 29, 2009 - 12:20 pm
Quote
Mikko Koppanen,
Thx a lot
#14 by bonez bone on July 31, 2009 - 7:22 pm
Quote
Hello Mikko Koppanen,
Can i use imagemagick to display the arabic word in image?
#15 by emery on August 10, 2009 - 4:28 am
Quote
Hi Mikko, it appears that the Imagick::affineTransformImage function never does anything. Was this function never implemented or am I using it wrong? I have an ImagickDraw matrix with several translates and rotates, and when I run $img->affineTransformImage($matrix) it is never changed.
#16 by Tomas Eklund on August 25, 2009 - 1:21 pm
Quote
Dear Mikko!
How do I pass the parameters “horizontal scale” and “vertical scale” to the Imagick::compositeImage method when using the imagick::COMPOSITE_DISPLACE composite operator? I’ve been struggling with this problem for several weeks now.
Thanks
Tomas Eklund
#17 by Mitch on August 29, 2009 - 8:05 am
Quote
I have a problem, it appears ImagickDraw::point ignores the specified stroke color and width, and is always black. I cannot fix this. Is it a bug?
#18 by Mikko Koppanen on August 30, 2009 - 9:52 pm
Quote
Hi Mitch,
as far as I know point is a single pixel. If you want to change the color try fill color instead of the stroke color. If you something larger try circle or rectangle depending on which shape you need.
#19 by Hannes on August 30, 2009 - 11:45 pm
Quote
Hi Mitch,
thanks for all the tutorials.
I try to redruce an image on black and white. I found a way with ImageMagick, but i want to do it with Imagick. Perhapt you know if its possible?
#20 by Tim on September 1, 2009 - 6:32 am
Quote
Hi Mikko– I’m using Imagick to resize some images I’m pulling down from a feed. About 10% of the image downloads PHP runs out of memory and the image gets corrupted (it looks like a bad negative or else the image gets split left to right and the order reversed). Is there any type of error checking in Imagick that will test if the resulting resized image is valid?
Thanks
PS my code looks like this–
$tn=$src_img->clone();
$tn->thumbnailImage($thumb_w,$thumb_h);
ob_start(); // start output buffer
$output = $tn->getimageblob();
echo $output;
#21 by Tomas Eklund on September 2, 2009 - 5:35 am
Quote
@Hannes:
I have successfully used:
$imgPhoto = new Imagick(“./photos/$photo.jpg”);
$imgPhoto->setImageColorspace(2); // converts to grayscale
If you want true b/w (not grayscale) follow up with something like:
$imgPhoto->thresholdImage(0×8000);
As with most Imagick commands thresholdImage is undocumented and it took me some time to figure out if it’s parameter would be a float between 0.0 and 1.0, a percentage between 0 and 100, an 8-bit value of 0 to 255 or a float representation of #000000 to #FFFFFF. It was none of these. The function seems to be expecting a 16-bit value between 0 and 65535 (0×0000 to 0xFFFF). The midpoint (middle gray) is 0×8000. You might have to experiment with different values if your images are very dark or bright.
#22 by Tomas Eklund on September 2, 2009 - 6:04 am
Quote
Dear Mikko,
I’ve been checking out your Amazon wish list for a while now. Those are some very fine items you wish for, but perhaps a tad expensive for the average Joe. I imagine that you would receive more donations if there were more items in different (lower) price ranges to choose from.
Just a friendly suggestion…
#23 by migajek on September 6, 2009 - 6:36 pm
Quote
Hi,
I found your blog very interesting, that is probably the best resource about PHP Imagick… what a pity that this extension is mostly undocumented, I believe it should replace GD in category of “default image manipulation library for php” as it is much more powerful !
Hope you’ll continue updating your blog with PHP Imagick examples …
#24 by Nikolaus Kühn on October 9, 2009 - 7:39 pm
Quote
Hello Mikko,
first of all thanks for making the Imagick library – it’s really a big gain for us (although some of the functions like cropImage seem buggy to be).
Nevertheless we managed to pull down a complete server today because of a change in the image conversion (dynamic target size with caching of the full-resolution images on the server). I suppose that the server started to remotely download and re-convert all the large files from our customer’s site in parallel.
Do you have any experience on how to optimize on-the-fly-image-conversion-scripts for memory and parallelity performance (is the imagick library safe for many parallel instances anyways?). We used a memory limit on the imagick api, but that didn’t seem to be right or too high or too low or…
regards, Nikolaus
#25 by Mikko Koppanen on October 9, 2009 - 9:40 pm
Quote
Nikolaus,
first of all: how is cropImage buggy?
I don’t really know what ’safe for parallel instances’ means but I don’t see what would be the problem assuming you have enough hardware to handle the load. If you are limited on the hardware side then it might make sense to look into making some sort of conversion queue.
#26 by Tomas Eklund on October 11, 2009 - 9:08 pm
Quote
Hi Mikko,
Glad to see that you are still alive… Thank you for the Imagick API. I understand that you are a busy man, working on many different projects and cannot devote yourself to the Imagick extension. I will be very pleased the day it is a finished product, and I sincerely hope it will be soon.
I’ve asked this before [I even tried bribing by making a small donation
] but didn’t receive an answer. So I’ll try again: How do I pass the parameters “horizontal scale” and “vertical scale” to the Imagick::compositeImage method when using the imagick::COMPOSITE_DISPLACE composite operator? I see that the method is there and it kind of works, but it is completely useless if you cannot pass these parameters to it.
Thanks
Tomas Eklund
#27 by Mikko Koppanen on October 12, 2009 - 2:04 am
Quote
Hello Tomas,
I unwrapped the book and accidentally threw off the paper (which contains the message and sender’s name). Sorry about that!
Regarding the COMPOSITE_DISPLACE see the following discussion:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=6&t=14851
I’ll add the method as soon as it becomes available.
#28 by Gangster54 on October 22, 2009 - 1:11 pm
Quote
This problem is one that has plagued other large industrialized cities for years. ,
#29 by Wolf48 on October 23, 2009 - 12:42 pm
Quote
The entire financial system was totally unprepared to deal with the inevitable collapse of the housing and credit bubbles. ,
#30 by Nicolas on October 28, 2009 - 1:45 pm
Quote
Hello,
I’m currently testing imagick for resizing purpose. I have one problem, I don’t see the equivalent of the “+map” option from the command line version of imagemagick.
What I want to do is to have one global color palette in a gif animation instead of a local palette for each frame. Could you guide me about how to do this with your API?
Thanks.
#31 by Kevan on October 29, 2009 - 12:32 pm
Quote
Mikko,
Thanks for all your hard work.
One quick question…just kidding…
Thanks for the great resource. I wish there were more like this…
Much appreciated.
Kevan
#32 by Nicolas on November 2, 2009 - 12:57 pm
Quote
I answer to myself, the PHP documentation is obsolete, as of v2.3 there’s new methods available, see http://pecl.php.net/package-changelog.php?package=imagick.
Imagick::remapimage may be what I’m looking for. Can’t test tough, as the fedora repo only has v2.2.2
#33 by Mikko Koppanen on November 2, 2009 - 1:42 pm
Quote
Hello,
I am currently working on the documentation but it is a painfully slow task. Documentation for those methods should be added already but it takes some time to sync to all documentation mirrors. Help on the documentation would be highly appreciated.
#34 by Nikolaus Kühn on January 8, 2010 - 1:54 am
Quote
Hi Mikko,
sorry for the late reply and the unclear initial question. With “parallel” I meant many apache requests and conversions on the image server in parallel. My specific issue was: What values are sensible for RESOURCETYPE_MEMORY in imagick? (in gmagick I can’t find a similar functionality anyways)
About the ->cropimage thing: I don’t have it in my head any more in detail, but my code comment says that it returned only 1*1 pixel images in my installation (from the ubuntu packages), which is why I used ->extentImage instead.
In the meanwhile I refactored our code, migrated to a new machine and added gmagick/graphicsmagick compatibility for performance and memory reasons. But I’m wondering how to emulate setting ->setImageMatte, ->matteFloodfillImage, ->shaveImage, ->setImagePage and ->setImageCompressionQuality in gmagick (the respective methods from imagick aren’t there and that probably has a reason).
Any Idea?
Thank you very much for your work and help,
Nikolaus
#35 by Lukas Kurowski on January 15, 2010 - 12:08 am
Quote
Hey, i want translate all of Your articles to polish and make a little site about it, can I do it? I will put Your link there.
Lukasz Kurowski.
#36 by Thomas Andersen on January 19, 2010 - 5:21 am
Quote
Is it possible to change text color of only one word in a line?
#37 by Adrian Jones on January 19, 2010 - 9:02 am
Quote
I would really appreciate some help with forcing RGB when converting an SVG file. All work fine by default so long as there is more than just black in the vector. But if only black, the resulting PNG becomes Gray/8 (photoshop) or 8-bit PseudoClass 256c (IM identify). It seems that the Pseudo is the problem – all the color ones show 8-bit DirectClass.
I have tried several things like:
$imagickImage->setImageFormat(“png32″);
$imagickImage->setImageType(7); //TrueColor
$imagickImage->setImageColorSpace(1); //RGB
$imagickImage->setImageType imagick::IMGTYPE_TRUECOLOR);
$imagickImage->setImageColorSpace(imagick::COLORSPACE_RGB);
$imagickImage->setImageDepth(8);
Obviously not all at once. Can you please clarify if it is ColorSpace or Colorspace (or does it not matter) and also whether I should be using the text or numerical values to set the space and type.
Is there something else I should be doing to force RGB and DirectClass so that it won’t automatically convert it to Grayscale.
Thank you
#38 by Stephane on February 5, 2010 - 10:32 pm
Quote
I am lost…
I have 4 images to create and after that I compose a bigger image including them.
So I am looking for the right way to pass result from my function to my imagik main page.
$Imagick1 = new Imagick();
$Imagick1 = createThumbnail1($x, $y); //want to received the result of this function
createThumbnail1($x, $y){
$ImagickC = new Imagick();
//creating thumbnail…
return $ImagickC; //is this the right type ?
//or return $Imagick->getImageBlob();
}
#39 by Mario on February 24, 2010 - 4:53 pm
Quote
Hi!
Is there a way to make a gradial-radient?
-> http://www.imagemagick.org/Usage/canvas/rgradient_range1.jpg
#40 by mcmatak on February 28, 2010 - 4:01 pm
Quote
Hi,
firstly imagick is amazing, it helps me lot.
But I maybe searched the whole internet, and I cant find the answer to contour on transparent png.
Or maybe the problem is in another place. What I need:
I have cdr (corel draw) images, i need work with them in php. I need change color of image, and i need contour of object in image. So what would be the best way, any chance how to work with cdr? transfer to svg in corel, it cant be loaded in imagick. I go first to make transparent png image with object in one color.
Change color in imagick i can, also make shadow is easy, but how to make the contour? stroke edges?
I am trying it for many days but no chance? do you have some idea?
thanks for any help
#41 by Pellet on March 15, 2010 - 10:18 am
Quote
Hi Adrian Jones,
Unfortunately Imagick::COLORSPACE_RGB does not seem to be correct anymore – if it was correct ever?
Instead use the number 255 i.e.
$imagickImage->setImageColorSpace(255);
This will make sure your image does not become greyscale.
cheers
-pellet.
#42 by Pellet on March 16, 2010 - 7:15 am
Quote
sorry adrian, i used that function to get the image to not be grayscale, however on further analysis of the resulting image, the colour turned out green instead of black… i am yet to work out the best way to get it to work yet
If anyone has any insights please let us know.
thanks,
-pellet.
#43 by Pellet on March 16, 2010 - 7:29 am
Quote
I just found a solution for adrian’s problem – he found it and posted it here : http://code.google.com/p/smart-lencioni-image-resizer/issues/detail?id=5#c6
you use $imagickImage->setOption(“png:color-type”,”6″);
to get it to output a non grayscaled png…
#44 by Jonathan Yarbor on March 26, 2010 - 11:46 pm
Quote
I love your blog. It is the unofficial bible of Imagick. I have been using imagick for some time, but I still can’t get get imagick to load any fonts or work with png images. Both really big drags. If want to help out contact me from one of the options on my website.
#45 by Simon on March 31, 2010 - 1:25 pm
Quote
Is there an efficient way to reduce the filesize of 24-bit PNGs (because of alphatransparency)? I tried:
$thumb = new Imagick($file->getPath());
$thumb->setImageFormat(‘png24′);
$thumb->setCompression(Imagick::COMPRESSION_LZW);
$thumb->setImageDepth(8);
but setting the compression does not seem to have any effect. If I output information via identifyImage() I get “JPEG” as “compression”.
The other strange thing is, that IrfanView tells me the image had 64 BitsPerPixel.
#46 by Fredyx on April 4, 2010 - 5:04 am
Quote
First, I’d like to thank you for the great work you do on Imagick. It’s awsome.
But, could you please give an example on how to draw a quadratic Bezier curve using pathCurveToQuadraticBezierAbsolute method or anything else?
I couldn’t find any example on how to use it with php, so any help will be appreciated.
Thank you in advance.
#47 by Sakke Nenye on April 18, 2010 - 11:04 pm
Quote
Puhutko suomea? Look the website http://www.leuku.fi
I have some problems to make imagick work on our new Windows Server 2008 64 bit configuration. What is the working version and what dll should we use for php? I tried ImageMagick-6.6.1-Q16 and 2009-11-18 23:33 – php_imagick_nts.dll (3.0.0-dev)
sakke
#48 by Luke Scammell on May 19, 2010 - 11:48 am
Quote
Thanks for all your hard work on imagick! However, I’m also having trouble with getting it to work on a Windows box. Any chance of either some updated php_imagick.dll binaries or a guide to compiling them from code for win32/x64?
I’d be happy to run some up-to-date compiles if it’s not too involved.
#49 by Hugh on June 6, 2010 - 2:59 am
Quote
Mikko, first of all let me echo the thanks for your work on imagick — it is great.
However I am having problems with making the .so for php5 with recent versions of imagemagick … the make goes smoothly however the module created causes PHP and Apache to have ’seg faults’. Apache complains of “seg fault or similar nasty error detected in the parent process” and the PHP CLI reports”Segmentation fault” whenever anything is run.
the package created with “ImageMagick 6.3.7 08/07/09 Q16″ seems ok, but with when created with “ImageMagick 6.6.2-2 2010-06-05 Q16″ or “ImageMagick 6.5.9-3 2010-02-12 Q16″ the seg fault appears
Do you have any suggestions or ideas?