GithubHelp home page GithubHelp logo

Comments (9)

Cruel avatar Cruel commented on July 20, 2024

This is a big problem for me as well (ImageMagick 6.7.8-9). With -colorspace RGB it darkens all my images, but without it it works fine.
Here's an original image: http://i.imgur.com/hJqqj.jpg
And here's resize() called on it: http://i.imgur.com/xiwvD.jpg

I just removed the default colorspace lines, hopefully there's no unintended issues with that, but I guess I'll find out.

from flourish-classes.

Tatsh avatar Tatsh commented on July 20, 2024

Now the issue is with -colorspace RGB the colours are way too dark.

Original: http://ky.tatsh.net/files/images/img_0246_copy1.jpg
Resized to 250px width: http://ky.tatsh.net/files/images/thumbs/img_0246.jpg

Command line:

'/usr/bin/convert' \
'jpg:/home/tatsh/dev/kusaba-y/files/images/thumbs/__flourish_temp/img_0246.jpg[0]' \
-resize "250x187" \
-colorspace RGB \
-compress JPEG \
-quality 90 \
'jpg:/home/tatsh/dev/kusaba-y/files/images/thumbs/__flourish_temp/img_0246.jpg' 2>&1

from flourish-classes.

wbond avatar wbond commented on July 20, 2024

It seems there are two options:

  1. Downgrade to a functioning version of ImageMagick
  2. Change fImage to detect the color palette of the original file and convert to RGB if the original is CMYK and the destination is JPG or PNG. This flag was originally added to handle resizing CMYK tiff files to JPGs since my last company wrote an app that ran into that situation quite frequently.

from flourish-classes.

Tatsh avatar Tatsh commented on July 20, 2024

I would prefer option 2 but I am unsure it is necessary, and for processing many images at once, would that not be a performance hindrance?

My solution is to just remove defaulting to any colorspace and let ImageMagick do the work. This means removing the check and adding. I already did this in my fork and I am having no problems (tested mostly pictures that come off my iPhone which uses sRGB). A user on the IRC channel for ImageMagick suspects a gamma conversion is occurring, but is unsure.

Tatsh@e2a9f26

from flourish-classes.

wbond avatar wbond commented on July 20, 2024

This issue with removing this is that resulting JPGs end up being CMYK JPGs, which don't display at all in some browsers.

from flourish-classes.

Tatsh avatar Tatsh commented on July 20, 2024

That is definitely worrying. Even IE 8 cannot show CMYK images.

The only way to check easily I think is to read using identify -verbose and get the line that has jpeg:colorspace: n (parse it) and fallback to exif_read_data(). Sometimes photos have no EXIF data so in the worse the case -colorspace argument may have to default to RGB.

from flourish-classes.

Tatsh avatar Tatsh commented on July 20, 2024

According to this page, ImageMagick 6.7.5 and up set the default colorspace to sRGB.

http://www.imagemagick.org/Usage/resize/#resize_colorspace

from flourish-classes.

wbond avatar wbond commented on July 20, 2024

Yeah, according to that page, it appears previous to 6.7.5, RGB and sRGB were swapped. To it appears the "fix" is to detect the version of ImageMagick and change the flag accordingly.

from flourish-classes.

Tatsh avatar Tatsh commented on July 20, 2024

This should come close and works for me.

Tatsh@3b112c5
Tatsh@492bbe2

from flourish-classes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.