Uploaded images appear dark

edited July 2014 in General Support
This is a follow-up to a question asked on this forum about a year ago.

I'm new to CA, but quite experienced in installing, configuring, and customizing web apps and content management systems that import and display images (e.g. Omeka, Drupal, WordPress, etc.), but I have never before encountered a problem quite like this. I am having essentially the same problem as the original poster, namely, a perfectly normal image (jpg or tiff) that looks fine when viewed using any image display program locally looks dark in CA Providence 1.4 (sometimes insanely dark, depending on the contrast of the original image).

I have attached a before-and-after example: the "before" file was attached to this forum post directly from my hard drive and the "after" is the same image after a "round trip" through CA (upload through Work -> Resources, click on the image, select "small" from the drop-down in the lower right, and click the download icon).

The answer to the original poster was (in essence): "The problem is not with CA. Your ImageMagick is probably screwed up. Go back and try again."

I'm not convinced that it's quite that simple in my case, as I have run ImageMagick convert (v. 6.7.7-10) manually from the shell prompt on the same server where CA is running, and everything looks fine. In addition, I am running two instances of Omeka (1.x and 2.x) on different subdomains on the same server as CA which use the same ImageMagick binary to do their image manipulation, and I see no similar problems.

The discussion in the original post mentioned something about color management. Could CA be somehow applying an "unusual" color profile by default that is not being applied by convert run from shell or by Omeka?

I am quite comfortable working with code, so if a CA developer-type-person could give me a pointer as to where to start looking, I can see how far I can manage to debug this myself. Any other suggestions would be hugely appreciated as well.

If we are unable to resolve this, then CA is a non-starter for our application...



240 x 240 - 7K
512 x 512 - 62K


  • We spent some time looking into it recently. The CA plugins force the colorspace of the uploaded image to RGB, to ensure that the resulting image is displayable in a web browoser if it was originally CMYK. Apparently, in some builds of ImageMagick that force-to-RGB causes it to impose the sRGB colorspace, even if the image is already RGB, and (seemingly - haven't confirmed this) not perform any color management. The end result is a dark image. Depending upon which image processing back-end you're using there's a line of code that has to come out to prevent this. We're planning to add a configuration option for this in an upcoming version.
  • Would you care to share which line of code that is? :-)
  • Which back-end are you using? In the ImageMagick command line plugin (app/lib/core/Plugins/Media/ImageMagick.php), it's this line: array_unshift($va_ops['convert'], '-colorspace RGB');

    In the Imagick plugin it's this: if (!$this->handle->setImageColorspace(imagick::COLORSPACE_RGB)) { at line 567

    There are similar lines in the GraphicsMagick and GMagick plugins.
  • Thanks for the help!
  • It seems that a similar problem is happening with the tilepic parsing (app/lib/core/Parsers/TilepicParser.php line 400).
  • Same deal. At line 400 and 454 change this: $va_ops = array('-colorspace RGB'); to this: $va_ops = array();

    You also need to get rid of these:

    if (!$h->setImageColorspace(imagick::COLORSPACE_RGB)) { at line 1537
    if (!$h->setimagecolorspace(Gmagick::COLORSPACE_RGB)) { at line 1747
  • I already "fixed" line 400, but didn't catch 454.

  • If you do a search for RGB in the file you're catch them all.
    Can you create a ticket for this? We should add a switch in the app.conf config file to disable colorspace changes. It's useful behavior... until it's now.

  • I see this matter came up in 2014 and I followed what is above with Providence 1.5.1 and solved the problem of dark images.

    Should I take the same steps to import clear images in 1.6.1 as the alteration does not appear to have been made to the version?

  • Yes, you should be able to fix it like before. I don't believe we added that switch.
  • Seth, I incurred in a similar issue with version CA v.1.7.8: an image with a custom color profile, generated true color preview images, but darker tilepics.
    I'm working with GraphicsMagick, and looking into TilepicParsers.php and GraphicsMagic.php, I found that in this file there is a good management of colorspaces (i.e. function _graphicsMagickWrite lines 1165-...), that seems be missing in TilepicParser.php.

    Any hint?

    Thank you


  • You should look at the files you're uploading and see what the colorspaces are. If you want to manipulate colorspaces in Tilepic.php go ahead and then do a pull request and we'll see about merging your changes.

  • Not a standard colorspace, unfortunately. But, why just the tiling is darker? what if make the changes to TilepicParser.php you suggested above?

  • Give it a try,

Sign In or Register to comment.