ImageMagick installing and exploring it, a good alternative for the GD library

Although PHP GD library handles basic image operations quite good, you have probably run into the limitations of GD library as well, it is often slow, memory intensive and a bit complicated to use for advanced image effects. ImageMagick however is a very good alternative. It is an opensource software suite licensed under a BSD style license from IM itself. ImageMagick provides in all functionality that can be accomplished with the GD library but even goes a step further with support for more advanced image edit techniques. An example of such a technique is the recently added “liquid scaling” feature, this is a content aware scaling option.

Click the image below to see an example of liquid scaling:
Liquid Scaling with imagemagick

So how do I get such a result? Well with PHP GD library it would take a whole lot of code, thinking and beers to get a script that does the same without exceeding your memory_limit, with ImageMagick however it is just one simple command.

exec("convert inputimage.jpg  -liquid-rescale 250x500%\!  outputimage.jpg");

The nice thing about ImageMagick is that you can often accomplish very sophisticated image effects with just one command, you can also chain commands. Now although IM has a quite good documentation guide available you maybe just want to be able to perform basic image operations with IM without seeking your way trough the documentation all the time. Their are some PHP classes available that will make your life easier.

My personal favor is PhMagick or a home brew script, why? Well I like the idea of wrapper classes more, my code is somewhat more portable because I don’t have to install the IM extension on a server and another PHP extension to communicate with it, furthermore I think that using wrapper classes gives you more insight in IM itself, you will better understand what is going on, on the other hand you probably will spend some hours to figure out why the command is not doing what you expected it to do because you are missing a simple ! or ^ parameter option.

Personal experience on installing IM on the server
Some time ago I wanted to install IM on my new dev and live server, the dev server is running OSX and the live server is running a Fedora distribution. So the first step before I tried to install IM was to read the documentation (yeah I’m one of those guys that also actually reads the readme files and documentation 😉 of products). I followed the “Install from source” tutorial. So I started with the live server, after downloading and unpacking IM I ran the ./configure command immediately I was faced with the error “no acceptable c compiler found in $PATH”, now my Linux skills are far from topnotch, so after some googling I found out that the easiest way to fix this issue was to install GCC (GNU Compiler Collection) that already included a C compiler. After installing GCC and running the ./configure command everything went fine, IM was installed successfully. I wanted to test if it was working correctly so I tried to resize several images but again an error occurred “convert: no decode delegate for this image format”, okay perhaps I should read the documentation more carefully next time because before installing IM you should also install the image libraries that you will use. In my case this was “yum install libjpeg libjpeg-devel libpng libpng-devel libtiff libtiff-devel”, now again I needed to install IM again, not much work, but still something to remember when installing IM. On the dev OSX server installing ImageMagick was quite simple, I used a precompiled dmg and only needed to install the Apple XCode developer tools.

So to summarize:

Advantages of using ImageMagick:

  • it uses less resources, forget about the memory_limit issues with PHP when using GD and large images
  • it’s slighty faster (note: depending on the filetype and image size GD beats IM in speed when it comes to resizing
  • Image Magick has support for more filetypes
  • as I showed before, it is very simple to use
    exec('convert "'.$sSourcePath.'" -resize '.$iWidth.'x"'.$sDestinationPath.'"');
  • Some very nice features like liquid scaling or seam carving

Disadvantages of using Image Magick:

  • you need to have full access to your server, it isn’t bundled with PHP
  • compiling IM can give some trouble, you shouldn’t forget to get the image libraries you want to use

Useful links

Comments

1,829 responses to “ImageMagick installing and exploring it, a good alternative for the GD library”

  1. WalterLeaws Avatar
    WalterLeaws

    https://iver.us.com/# Iver Protocols Guide

  2. MarcusenUrb Avatar
    MarcusenUrb

    generic propecia no prescription: Follicle Insight – cost of generic propecia without insurance

  3. Michaelles Avatar
    Michaelles

    Follicle Insight: cost generic propecia without insurance – Follicle Insight

  4. EdwardLaush Avatar
    EdwardLaush

    order cheap clomid for sale fertility pct guide buying clomid without rx

  5. Michaelles Avatar
    Michaelles

    Follicle Insight: cost propecia prices – order generic propecia without dr prescription

  6. WalterLeaws Avatar
    WalterLeaws

    https://follicle.us.com/# Follicle Insight

  7. MarcusenUrb Avatar
    MarcusenUrb

    generic propecia tablets: cheap propecia without prescription – get propecia pills

  8. Michaelles Avatar
    Michaelles

    buy Elavil: Elavil – Amitriptyline

  9. MarcusenUrb Avatar
    MarcusenUrb

    stromectol otc: Iver Protocols Guide – Iver Protocols Guide

  10. WalterLeaws Avatar
    WalterLeaws

    https://iver.us.com/# ivermectin price usa

  11. Michaelles Avatar
    Michaelles

    generic clomid without a prescription: get clomid tablets – fertility pct guide

  12. EdwardLaush Avatar
    EdwardLaush

    AmiTrip Relief Store AmiTrip Relief Store buy Elavil

  13. MarcusenUrb Avatar
    MarcusenUrb

    where to buy cheap clomid online: fertility pct guide – where buy clomid for sale

  14. Michaelles Avatar
    Michaelles

    Generic Elavil: AmiTrip – buy Elavil

  15. WalterLeaws Avatar
    WalterLeaws

    https://iver.us.com/# Iver Protocols Guide

  16. MarcusenUrb Avatar
    MarcusenUrb

    ivermectin 9 mg: Iver Protocols Guide – Iver Protocols Guide

  17. Michaelles Avatar
    Michaelles

    fertility pct guide: fertility pct guide – where can i get clomid pill

  18. MarcusenUrb Avatar
    MarcusenUrb

    Iver Protocols Guide: where to buy ivermectin – Iver Protocols Guide

  19. EdwardLaush Avatar
    EdwardLaush

    Generic Elavil Amitriptyline Amitriptyline

  20. fdertolmrtokev Avatar

    There is noticeably a bundle to know about this. I assume you made certain nice points in features also.

  21. WalterLeaws Avatar
    WalterLeaws

    https://follicle.us.com/# Follicle Insight

  22. Michaelles Avatar
    Michaelles

    can i get clomid online: where to buy generic clomid prices – where can i buy generic clomid now

  23. MarcusenUrb Avatar
    MarcusenUrb

    Follicle Insight: cost cheap propecia without a prescription – Follicle Insight

  24. Michaelles Avatar
    Michaelles

    Iver Protocols Guide: stromectol canada – Iver Protocols Guide

  25. WalterLeaws Avatar
    WalterLeaws

    https://follicle.us.com/# Follicle Insight

  26. MarcusenUrb Avatar
    MarcusenUrb

    get generic propecia prices: cost of propecia pills – cost propecia price

  27. EdwardLaush Avatar
    EdwardLaush

    can i buy clomid without a prescription fertility pct guide fertility pct guide

  28. Michaelles Avatar
    Michaelles

    Iver Protocols Guide: Iver Protocols Guide – Iver Protocols Guide

  29. MarcusenUrb Avatar
    MarcusenUrb

    AmiTrip Relief Store: AmiTrip Relief Store – buy Elavil

  30. Michaelles Avatar
    Michaelles

    Follicle Insight: Follicle Insight – cost of cheap propecia without insurance

  31. MarcusenUrb Avatar
    MarcusenUrb

    cost generic propecia tablets: get propecia without rx – cost generic propecia for sale

  32. EdwardLaush Avatar
    EdwardLaush

    fertility pct guide buying generic clomid where to get generic clomid price

  33. WalterLeaws Avatar
    WalterLeaws

    https://amitrip.us.com/# AmiTrip Relief Store

  34. Michaelles Avatar
    Michaelles

    ivermectin 80 mg: buy ivermectin – Iver Protocols Guide

  35. Duanegat Avatar
    Duanegat

    Hello, if you are looking for a useful article regarding common medicines, check out this medical reference. You can read about safety protocols in detail. See details: https://magmaxhealth.com/Flonase. Hope this is useful.

  36. MilesCed Avatar
    MilesCed

    Hello, I recently found side effects info on common medicines, I recommend this medical reference. You can read about drug interactions in detail. See details: https://magmaxhealth.com. Good info.

  37. MatthewGuert Avatar
    MatthewGuert

    Greetings, I wanted to share a trusted health store to order prescription drugs securely. I found this pharmacy: olanzapine. Selling generic tablets and huge discounts. Hope this helps.

  38. Duanegat Avatar
    Duanegat

    Hi all, for those searching for dosage instructions on health treatments, check out this health wiki. It covers drug interactions in detail. Read more here: https://magmaxhealth.com/Olanzapine. Good info.

  39. DonaldNaila Avatar
    DonaldNaila

    regarding the side effects and interactions, data is available at the detailed guide on: https://magmaxhealth.com/lamictal.html for risk management.

  40. MilesCed Avatar
    MilesCed

    Hey everyone, I recently found a useful article regarding common medicines, I found this drug database. It explains how to take meds very well. See details: https://magmaxhealth.com/Rosuvastatin. Hope it helps.

  41. Duanegat Avatar
    Duanegat

    Hi all, for those searching for side effects info about common medicines, I found this useful resource. It explains usage and risks clearly. Link: https://magmaxhealth.com/Toradol. Thanks.

  42. Duanegat Avatar
    Duanegat

    Hey everyone, if anyone needs dosage instructions regarding common medicines, check out this online directory. It explains drug interactions in detail. Reference: https://magmaxhealth.com/Toradol. Good info.

  43. Danieledget Avatar
    Danieledget

    regarding the medical specifications, it is recommended to check this resource: https://magmaxhealth.com/lamictal.html which covers safe treatment.

  44. MilesCed Avatar
    MilesCed

    Hi, I recently found detailed information on common medicines, take a look at this useful resource. It covers safety protocols in detail. Source: https://magmaxhealth.com/Olanzapine. Very informative.

  45. DonaldNaila Avatar
    DonaldNaila

    For a complete overview of safety protocols, it is recommended to check the official information page at: https://magmaxhealth.com/clarinex.html which covers clinical details.

  46. Duanegat Avatar
    Duanegat

    Hey everyone, I recently found a medical guide on prescription drugs, I found this online directory. It explains drug interactions in detail. Link: https://magmaxhealth.com/Protonix. Hope it helps.

  47. gaiaathome.eu Avatar

    References:

    Oysters casino

    References:
    gaiaathome.eu

  48. Duanegat Avatar
    Duanegat

    Hi, if anyone needs dosage instructions about common medicines, I found this medical reference. You can read about usage and risks clearly. Read more here: https://magmaxhealth.com/Prilosec. Good info.

  49. schoolido.lu Avatar

    References:

    No deposit bonus binary options

    References:
    schoolido.lu

Leave a Reply

Your email address will not be published. Required fields are marked *