Jump to content

Imagick Resizer need to be tested (2)


horst
 Share

Recommended Posts

--------------------------------------------------------------------------------------------------------------------

UPDATE:

This module is not supported. It was only working for PW versions between 2.4.3 and 2.5.11

But since PW 3.0.10-devns, there is core support for the Imagick PHP extension, and with third party modules ImageMagick_CLI and Netpbm_CLI is supported too. And I think, when time goes on, there will follow some more.

--------------------------------------------------------------------------------------------------------------------

 
 
 
Hi, for those who don't know it already, we have started to build an ImageSizer replacement based on Imagick / ImageMagick.
 
Its actual state is that we now have implemented a basic color management and optionally an ICC-based more accurate color management.
 
Due to not finding much answers and informations on the net about that we have had some struggle to get it working on different ImageMagick versions. And even if it works on three or four versions that we can get hands on, we need more informations of supported versions.
 
There for it would be really helpful that you test that feature on as many different servers you can and report back the result.
 
To make that as easy as possible I have created a Siteprofile together with the latest PW-Devbranch and a brandnew ImageSizer.php. You can get it above in this post as ZIP. It has many images for different tests and it is more robust now.

  • after installing the site profile, you need to install the Imagick Resizer in the admin under section modules
     
  • the frontpage is a site with different image tests
     
  • to run the tests you need to be logged in (in the backend)
     
  • we are interested in the results of ImagickResizer test cms-with-icc_short
     
  • if the first test looks successful (all text is green) you may go on and test ImagickResizer test cms-basic_visual
     
  • and maybe ImagickResizer test cms-with-icc_visual

At the end of the page you should see a summary like that:

array(13) 
{
  ["test"]                                    string(18) "cms-with-icc_short"
  ["hasUsedCMS"]                              string(3) "6/6"
  ["executiontime"]                           string(12) "5.9393400000"
  ["engine"]                                  string(18) "Apache 2.0 Handler"
  ["php"]                                     string(6) "5.4.26"
  ["os"]                                      string(81) "Windows NT KAWOBI 6.1 build 7601 (Windows 7 Business Edition Service Pack 1) i586"
  ["imageMagick"]                             string(5) "6.8.8"
  ["imagick module version"]                  string(5) "3.1.2"
  ["imagick classes"]                         string(56) "Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator"
  ["ImageMagick version"]                     string(38) "ImageMagick 6.8.8-4 Q16 x86 2014-01-29"
  ["ImageMagick copyright"]                   string(46) "Copyright (C) 1999-2014 ImageMagick Studio LLC"
  ["ImageMagick release date"]                string(10) "2014-01-29"
  ["ImageMagick number of supported formats"] string(3) "225"
}

Please first visually check if the images look ok or if they have strange issues (e.g. very much to brighten). Report if the images are ok and copy/paste that summary array here into the thread (please use the [<>] code button when pasting - for good readability!).
 
Do that for the first test (cms-with-icc_short) regardless if it succeeds or failed!
 
If you do not see a summary, there is a great chance that you are not logged in or that you have selected a different test than that we are interested in :)
 
As a visual reference you can look here for the short_test, the test with icc
and here for a basic test result.
 
Note: Without icc-cms the cymk and gray images do not look good, but this is expected!

Edited by horst
  • Like 4
Link to comment
Share on other sites

Hey horst,

I just tried to install your profile test site and get the following error. I followed up with an install of the latest dev (April 3rd) and it worked fine, so looks like there is maybe something corrupted in your profile.

Anyone else having troubles with it?

post-985-0-60296800-1397322257_thumb.png

There are no php errors of significance that suggest what the issue might be either.

Link to comment
Share on other sites

Hi Adrian,

I have tried it here myself without errors. Have you used the embedded wire folder from my zip-archive?

I have downloaded it just once more from here, unzipped and started. Runs without error and works fine for me. ??

If it do not for you: you can use the dev branch from april but need to use the ImageSizer.php from my zip-wire/core folder. It is modified that it can work together with ImagickResizer. Also there is a folder /_phpcls/ that is needed. It contains some libs (timer, better var_dump output, php-api) that are used to create the test summaries.

|--/_phpcls/
|
|--/site/
|
|--/wire/
|

The libs get included in the site/config.php

Edited by horst
Link to comment
Share on other sites

I actually installed from scratch just using the files in your zip. I saw the wire folder in there and so didn't think there was need to do the normal profile install method of copying just those certain folders across.

The problem is those extra lines you added to config.php. I am looking at them now to see if I can narrow down the issue.

EDIT: It was the require_once failing due to a path problem. I just hard coded the path for now to get things working. 

Edited by adrian
Link to comment
Share on other sites

I actually installed from scratch just using the files in your zip. I saw the wire folder in there and so didn't think there was need to do the normal profile install method of copying just those certain folders across.

The problem is those extra lines you added to config.php. I am looking at them now to see if I can narrow down the issue.

Maybe I did not get it right, just to be more clear: my zip is meant to use as is, copied to a server and run the installer, like you would do with a downloaded one from github. Normally there should be no issues with the config.php during install process.

Link to comment
Share on other sites

Yeah, it was the path to those _phpcls classes. I am testing locally and it seems like there was an issue with $_SERVER['DOCUMENT_ROOT']. Once I hardcoded this, the install works fine. So maybe just an issue for me and no-one else will be affected.

  • Like 1
Link to comment
Share on other sites

OK,

cms-basic-visual

array(12)
{
["hasUsedCMS"] string(1) "0"
["executiontime"] string(12) "2.3945900000"
["engine"] string(18) "Apache 2.0 Handler"
["php"] string(6) "5.4.27"
["os"] string(71) "Linux 2.6.32-5-amd64 #1 SMP Mon Sep 23 22:14:43 UTC 2013 x86_64"
["imageMagick"] string(5) "6.6.7"
["imagick module version"] string(5) "3.1.2"
["imagick classes"] string(56) "Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator"
["ImageMagick version"] string(34) "ImageMagick 6.6.7-5 2011-02-05 Q16"
["ImageMagick copyright"] string(46) "Copyright (C) 1999-2011 ImageMagick Studio LLC"
["ImageMagick release date"] string(10) "2011-02-05"
["ImageMagick number of supported formats"] string(3) "194"
}

post-985-0-76549100-1397326920_thumb.png

cms-with-icc-visual

array(12)
{
["hasUsedCMS"] string(1) "1"
["executiontime"] string(12) "2.4738700000"
["engine"] string(18) "Apache 2.0 Handler"
["php"] string(6) "5.4.27"
["os"] string(71) "Linux web 2.6.32-5-amd64 #1 SMP Mon Sep 23 22:14:43 UTC 2013 x86_64"
["imageMagick"] string(5) "6.6.7"
["imagick module version"] string(5) "3.1.2"
["imagick classes"] string(56) "Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator"
["ImageMagick version"] string(34) "ImageMagick 6.6.7-5 2011-02-05 Q16"
["ImageMagick copyright"] string(46) "Copyright (C) 1999-2011 ImageMagick Studio LLC"
["ImageMagick release date"] string(10) "2011-02-05"
["ImageMagick number of supported formats"] string(3) "194"
}

post-985-0-89871300-1397326931_thumb.png

  • Like 1
Link to comment
Share on other sites

On my machine Imagic Class is not loaded. This is on PHP Version 5.5.8.

Darwin Czech-iMac.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64

Error: Class 'Imagick' not found (line 140 of /Users/martijn/Sites/domains/imagick/htdocs/site/modules/ImagickResizer/ImagickResizer.module)

I can try to install Imagic as here is a how to do (never done this before) and I hope I will not screw it. 

  • Like 1
Link to comment
Share on other sites

On my machine Imagic Class is not loaded. This is on PHP Version 5.5.8.

Darwin Czech-iMac.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64

Error: Class 'Imagick' not found (line 140 of /Users/martijn/Sites/domains/imagick/htdocs/site/modules/ImagickResizer/ImagickResizer.module)

@Martijn: oh, please can you patch this:

    /**
     * returns the ImageMagick Version
     *
     * @return mixed: array, string
     */
    static public function getImageMagickVersion($fullString=false) {
        if(!ImagickResizer::hasImagick()) return $fullString ? 'Not available' : '0.0.0';
        $im = new Imagick();
        $a = $im->getVersion();
        $im->clear();
        $im->destroy();
        $im = null;
        preg_match('/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $a['versionString'], $v);
        return $fullString ? $a['versionString'] : $v[1];
    }

    /**
     * returns if Imagick PHP extension is available or not
     *
     * @return boolean
     */
    static protected function hasImagick() {
        return class_exists('Imagick');
    }

Edited by horst
Link to comment
Share on other sites

@Adrian: the test with ICC doesn't look as expected!

There are also 2 images missing (sRGB Jpegs). Are you shure all files are uploaded correctly? (Especially the ICC-profiles?)

Link to comment
Share on other sites

@Raymond: If you read this, Can you please apply the patch Horst provided.

 

Shit ! Read your message to late Horst. I successfully installed Imagic.

For other users using the same setup as I do (Raymond, Arjen) I confirm that ImageMagick installer for Mac OS X is working. Big thanks to cactuslab!

Sorry guys... Some how I thought this was working.. it doesn't..

Edited by Martijn Geerts
  • Like 1
Link to comment
Share on other sites

It was an issue with the case of image filenames. In your zip you had:

colortarget_sRGB_8bit.jpg but it was looking for colortarget_srgb_8bit.jpg

Are you on a windows server, or something else that doesn't check filename case?

  • Like 1
Link to comment
Share on other sites

It was an issue with the case of image filenames. In your zip you had:

colortarget_sRGB_8bit.jpg but it was looking for colortarget_srgb_8bit.jpg

Are you on a windows server, or something else that doesn't check filename case?

This is unbelievable, I thought PW will do lowercase all image filenames on upload. :lol:

But seriously: I might have updated the files in my installation just by copying them over, after they were installed from PW. And yes I'm on windows.

But the CMYK and gray images are not what is expected after a ICC-profile conversion. I have to think about a better test that returns if all profiles needed for the conversion were found on a per image basis.

PS: Adrian the bug hunter! ^-^

Edited by horst
  • Like 2
Link to comment
Share on other sites

Sorry guys... Some how I thought this was working.. it doesn't..

@Martijn: To install it under my windows apache I struggled over 2 days to find a php Imagick extension and the right ImageMagick installation that all together works with my PHP Version. It took me 3 hours :(  Following is what I have found to work finally. Martijn, you will do this for the Mac when you have solved it, right? :)

You first need to check if you are running a x86 (32bit) Apache / PHP or really a x64 bit one. I'm not sure but most installations on Windows maybe x86 (regardless if you running a x64 windows).

I have taken a Imagick extension from here: http://www.peewit.fr/imagick/

I'm running PHP 5.4.26 as apache module and it is a ThreadSafe version what needs to be compiled with MSVC 9

The ImageMagick app is from here: http://imagemagick.org/script/binary-releases.php#windows

I took the ImageMagick-6.8.9-0-Q16-x86-dll.exe it is for Win32 (x86), it should be a dynamic version (no static one) and we want 16bit pixel support

If you work with other versions of Apache and PHP (e.g. x64) you need to choose x64 versions (MSVC 11 compiled) of ImageMagick / Imagick

My Apache and PHP was already running so I installed ImageMagick with their provided Installer. The only important part was to tipp the checkbox that ask you to put the path from ImageMagick into your system-path variable!

Second I copied the php_imagick.dll into the php extensions directory (look into php.ini at extension_dir = ) and add a line into the php.ini under Dynamic Extensions:

extension=php_imagick.dll

After restarting the Apache service I could see Imagick in the list of phpinfo().

Check this and also if you have a number higher than 0 for supported fileformats / imageformats in that phpinfo section. (with my first try installing ImageMagick I got versions that doesn't colaborate together what results in 0 supported fileformats there)

  • Like 2
Link to comment
Share on other sites

I have updated the Siteprofile ZIP: look in the first post
 
You now first must install the Imagick Resizer module. Also it is more robust and check if you have installed Imagick on your server also on the frontpage when trying to read the version numbers.
 
@Adrian: I have added new/changed tests for icc-cms. Now the usage of ICC-files is reflected in the search result for every single image!
Please drop the old profile and run the new one from scratch. (remember first to edit the includes in config.php)
 
Read the slightly new instructions in the first post here in this thread.

Edited by horst
Link to comment
Share on other sites

Ok, here you go:

array(13)
{
["test"] string(18) "cms-with-icc_short"
["hasUsedCMS"] string(3) "6/6"
["executiontime"] string(12) "0.5492970000"
["engine"] string(18) "Apache 2.0 Handler"
["php"] string(6) "5.4.27"
["os"] string(71) "Linux 2.6.32-5-amd64 #1 SMP Mon Sep 23 22:14:43 UTC 2013 x86_64"
["imageMagick"] string(5) "6.6.7"
["imagick module version"] string(5) "3.1.2"
["imagick classes"] string(56) "Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator"
["ImageMagick version"] string(34) "ImageMagick 6.6.7-5 2011-02-05 Q16"
["ImageMagick copyright"] string(46) "Copyright (C) 1999-2011 ImageMagick Studio LLC"
["ImageMagick release date"] string(10) "2011-02-05"
["ImageMagick number of supported formats"] string(3) "194"
}

post-985-0-81688000-1397493177_thumb.png

array(13)
{
["test"] string(16) "cms-basic_visual"
["hasUsedCMS"] string(4) "0/18"
["executiontime"] string(12) "2.5764840000"
["engine"] string(18) "Apache 2.0 Handler"
["php"] string(6) "5.4.27"
["os"] string(71) "Linux 2.6.32-5-amd64 #1 SMP Mon Sep 23 22:14:43 UTC 2013 x86_64"
["imageMagick"] string(5) "6.6.7"
["imagick module version"] string(5) "3.1.2"
["imagick classes"] string(56) "Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator"
["ImageMagick version"] string(34) "ImageMagick 6.6.7-5 2011-02-05 Q16"
["ImageMagick copyright"] string(46) "Copyright (C) 1999-2011 ImageMagick Studio LLC"
["ImageMagick release date"] string(10) "2011-02-05"
["ImageMagick number of supported formats"] string(3) "194"
}

post-985-0-22726100-1397493306_thumb.png

array(13)
{
["test"] string(19) "cms-with-icc_visual"
["hasUsedCMS"] string(5) "18/18"
["executiontime"] string(12) "2.5627950000"
["engine"] string(18) "Apache 2.0 Handler"
["php"] string(6) "5.4.27"
["os"] string(71) "Linux 2.6.32-5-amd64 #1 SMP Mon Sep 23 22:14:43 UTC 2013 x86_64"
["imageMagick"] string(5) "6.6.7"
["imagick module version"] string(5) "3.1.2"
["imagick classes"] string(56) "Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator"
["ImageMagick version"] string(34) "ImageMagick 6.6.7-5 2011-02-05 Q16"
["ImageMagick copyright"] string(46) "Copyright (C) 1999-2011 ImageMagick Studio LLC"
["ImageMagick release date"] string(10) "2011-02-05"
["ImageMagick number of supported formats"] string(3) "194"
}

post-985-0-33751200-1397493389_thumb.png

  • Like 1
Link to comment
Share on other sites

Thanks Adrian,

but the cmyk and grayscales don't look as expected, also not with the new tests. :)

Maybe the ImageMagick version 6.6.7 is to old.

Lets collect some more infos during the next two weeks, hopefully.

@all: Hey, download it and send us a test result :)

Link to comment
Share on other sites

Agreed - they don't look good :(

That's on my production server and IM is compiled with rsvg and ghostscript and I am hesitant to upgrade it at the moment because I have definitely come across version conflicts between all these things in the past, but I'll try to get my testing server up to date with all the latest versions and send you results from those.

Link to comment
Share on other sites

Adrian, the usage of all RGB files are good. To upload and use cmyk for web display is not what is used in real life. We test it here to see how it works in general. But the grayscales are not handled too. Also this may not a problem if you are the one that uploads images to that server. You should prepare your images all the same (gamma 1.8 or 2.2), not mixing different versions. That way you can work with the 6.6.7 without problems.

You can have a look to the other tests, especially to sharpening with Imagick. It is very fast compared to GD! Also resizing without sharpening is not that blurry like with GD. But best of all: we can sharpen transparent PNGs with it! You can run it on your installation too, these test and images are also included.

Link to comment
Share on other sites

@Adrian: I remember you can use the exec() method on your server. You may check if you have the lcms library used by ImageMagick. To check this you may run the code snippet below and look under cofigure -> delegates if it is listed, and in the delegates output if it is bound to something what isn't the default.

    [15] => DELEGATES      bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib

Also it would be good if we can get this information via Imagick extension or something else, if exec() is unavailable. Do you have an idea?

<?php
    $path2convert = '/usr/bin/';
    $cmds = array(
        'convert -list configure',
        'convert -list delegate',
        //'convert -list format'
        );

    function runExec($cmd) {
        global $path2convert;
        exec("{$path2convert}$cmd 2>&1", $out, $result);
        if(0!=$result) {
            echo "Returncode: " .$result ."<br>";
            echo "<pre>"; print_r($out); "</pre>";
        }
        else {
            echo "<pre>\n"; print_r($out); "\n\n</pre>";
        }
    }

    foreach($cmds as $cmd) runExec($cmd);
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...