Imagick convert color profiles from AdobeRGB to sRGB

I did a search but didn't find something useful as it is advised to upload images in sRGB profile (obviously)

I would like to do this:
- upload my 3000x2000 images in AdobeRGB profile
> These uploads are not intended for web display but for the client to download.
- generate cache images and thumbnails in sRGB
> I think it is possible to convert color profiles with Imagick

I would like some advise on which files I should look at and maybe any suggestions on how to do it.

Cheers

Comments

  • acrylian Administrator, Developer
    Hopefully kagutsuchi who did Imagick for us will see this post. I would test if your server can really handle these large images and several of them (see the troubleshooting). If you really need fine data (or even more hires) it might be better to store such outside the albums itself (some work I admit)
  • Certainly without Imagick the color profiles will be a problem. Even with them there might be issues. Imagick will preserve profiles, but that will be no help if your audience is viewing the images in a browser that does not support color profiles. (That is pretty much the norm right now.) I do not know if Imagick can convert the profiles. Currently there is no Zenphoto option to cause that to happen.

    Imagick is supposed to be better at memory management than the standard GD library. But even then resizing those images might not work.

    But of course, the first step is to see if you even have Imagick capability with your hosting service.
  • Thanks for the replies guys!

    I had some experience with image processing before and ran into GD memory problems. So I learned about Imagick,. and got myself I server who supported it. I had a rough time compiling the imagick module on my Mac though but in the end I won :)

    My ZP installation infos:
    PHP memory limit: 140M (Note: Your server might allocate less!)

    The trouble shooting page mentioned by acrylian guidlines: (in my 3000 x 2000 px case)

    6 MP Image, 2816 x 2112 pixels => needs ~22.6 MB Memory

    I had a look in my servers php.ini:
    `
    ;;;;;;;;;;;;;;;;;;;

    ; Resource Limits ;

    ;;;;;;;;;;;;;;;;;;;

    max_execution_time = 60 ; Maximum execution time of each script, in seconds

    max_input_time = 60 ; Maximum amount of time each script may spend parsing request data

    memory_limit = 140M ; Maximum amount of memory a script may consume (8MB)
    `
    So I think I am fine.

    ---

    Just tested it and no problems processing at all!
    The cached image and thumb files have indeed the AdobeRGB color profile embedded (with Imagick enabled)

    Now if could find out where the imagick functions are writing in ZP...

  • OK I just found how to NOT retain the imagick color profile:

    zp-core.php
    zp_resampleImage()
    if (IMAGICK_RETAIN_PROFILES)

    Now I need to research the conversion (reliability, performance)

    Starting to fall in love ZP :))
  • I don't have experience with manually adding profiles, but what you would need is not built into `lib-Imagick.php` without personal modification. However, the function you would need is `Imagick::profileImage()`. See http://us3.php.net/manual/en/function.imagick-profileimage.php

    The better alternative, I think, is to upload the sRGB images to Zenphoto and use those as normal. The images will be cached with the sRGB profile as such. Then, I would link to the AdobeRGB images within the theme but outside of Zenphoto. Since you're not displaying the AdobeRGB images, there's really no point to having Zenphoto in the middle, but that's completely my opinion.

    If you do decide to add in the functionality, here's a short overview of how `zp_resampleImage()` works for Imagick. The `IMAGICK_RETAIN_PROFILES` define only checks to see if it's possible to use the `Imagick::profileImage()` function. Then, the `foreach` will migrate each profile of the original image to the resampled image. So, depending on if you want the original profiles, you might want to delete that `foreach` statement.

    The rest of what you need to add the profile to the image manually should be in the link at the top of my post. Just remember that if you modify core files, you will have to add your modifications again every time you update Zenphoto.
  • Thank you kagutsuchi for the reply!
    You are right, I should upload AdobeRGB files separately, outside ZP. It's a good excuse for me to charge my users for the extra upload. Most of them will print sRGB anyway.

    I found an article on how to do the conversion but it does not really work for me, I think due to the older version of imagick on my host. Actually I can do the conversion but with a filesize way to big (can't delete the ARGB profile before assigning sRGB)
    Anyways just for reference:
    http://ezzatron.com/2010/03/17/creating-web-thumbnails-with-php-imagick/

    Thanks again, great ZP community :-)
  • acrylian Administrator, Developer
    Btw, for the possible download of the separately stored files I would suggest to use the downloadlist plugin and its function for direct file downloads.
    If you make both image versions with the same names (e.g. replicated the /albums structure) generating these links would be quite easy.
Sign In or Register to comment.