Imagick « Mikko’s blog

Beaucoup de tutoriels au sujet d’ImageMagick (Utile pour le plugin doc2img)

http://valokuva.org/?cat=1

Les articles publiés sur le site

  • phplondon conference 2008

    2 mars 2008, par Mikko KoppanenEverything else, Imagick, PHP stuff, phplondon08

    To summarize it: I had fun :) My conference preparations started about two weeks before the conference. The PHPLondon fellows (Paul, Matt and Richard) asked me to do a small presentation about Imagick at the pre-conference social event. The presentation I assembled ended up being a little over two hours, give or take. The hardest part was to trim down from two hours to about 40 minutes (I didn’t want to bore the people with too many code examples). The slides are available at http://valokuva.org/talks if you need them for some reason.

    My conference day was pretty hectic from the beginning to the end. I gave a few demos about the products that we represent and the moment I opened my mouth for the first time people started leaving the room. I hope that it had something to do with the “My Framework is better than yours?” talk starting at the same time ;)

    I met quite a lot of new people at the conference and of course it was nice to see the familiar faces from other conferences and PHPLondon meetings. I was especially happy that I was able to answer the questions Nigel James had ;)

    A huge thanks to the organizers for making this day possible!

  • Seam carving

    13 février 2008, par Mikko KoppanenImagick, PHP stuff

    Today I was reading trough the ImageMagick ChangeLog and noticed an interesting entry. “Add support for liquid rescaling”. I rushed to check the MagickWand API docs and there it was: MagickLiquidRescaleImage! After about ten minutes of hacking the Imagick support was done. Needless to say; I was excited :)

    For those who don’t know what seam carving is check the demo here. More detailed information about the algorithm can be found here: “Seam Carving for Content-Aware Image Resizing” by Shai Avidan and Ariel Shamir

    To use this functionality you need to install at least ImageMagick 6.3.8-2 and liblqr. Remember to pass –with-lqr to ImageMagick configuration line. You can get liblqr here: http://liblqr.wikidot.com/. The Imagick side of the functionality should appear in the CVS today if everything goes as planned.

    Here is a really simple example just to illustrate the results of the operation. The parameters might be far from optimal (didn’t do much testing yet). The original dimensions of image are 500×375 and the resulting size is 500×200.

    Update: the functionality is pending until license issues are solved.

    1. <?php
    2.  
    3. /* Create new object */
    4. $im = new Imagick( 'test.jpg' );
    5.  
    6. /* Scale down */
    7. $im->liquidRescaleImage( 500, 200, 3, 25 );
    8.  
    9. /* Display */
    10. header( 'Content-Type: image/jpg' );
    11. echo $im;
    12.  
    13. ?>

    The original image by flickr/jennconspiracy

    result

    And the result:

    result

    Update. On kenrick’s request here is an image which is scaled down to 300×300

    result2