Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color profiling issue #88

Closed
canvasmanager opened this issue Jan 12, 2016 · 11 comments
Closed

Color profiling issue #88

canvasmanager opened this issue Jan 12, 2016 · 11 comments

Comments

@canvasmanager
Copy link

I have ran Jimp resize on this image
jimp_issue-orig

The image got converted into this one:

jimp_issue

@skoa-h
Copy link

skoa-h commented Jan 14, 2016

Hi,

your source jpg is CMYK colortype, jimp and the underlying pngjs only support RGB and RGBA colortype. I don't know, if there are plans to support additional colortypes.

@canvasmanager
Copy link
Author

Hi Skoah,

Do you know any package which is good for ascertaining the Color Space "CMYK". I tried multiple options but none works consistently. I don't want to install any package like GM. If it is some JS only package, it should be good.

Thankyou,
Manik Mittal

@skoa-h
Copy link

skoa-h commented Jan 21, 2016

Hi Manik,

There is color-js, which I never used but it does not support cmyk I think.

I don't think there is a good solution but Graphics-/ImageMagick for color space conversion and color profile management / conversion, at least not JS-only.

Regards
Skoah

@oliver-moran
Copy link
Collaborator

Yes. Looks like colour space is the culprit again. But this issue is stark compared to here: #84

The best place to deal with this is at the jpeg-js library, which does the reading/writing of JPEGs (Jimp just pushes pixels around): https://github.com/eugeneware/jpeg-js

@canvasmanager
Copy link
Author

Hi Oliver / Skoah,

I got an interim solution to it. I used npm package sharp (https://www.npmjs.com/package/sharp) to extract the color space data. I am not Jimping the images with color space "CMYK".

I have raised the issue with jpeg-js library as well jpeg-js/jpeg-js#13

Thanks for your help. Truly appreciate.

@skoa-h
Copy link

skoa-h commented Jan 22, 2016

Hi Manik,

good to see that you found a solution. Maybe in the future there is a pure js solution for this.

Regards
Skoah

@strandedcity
Copy link
Contributor

strandedcity commented Apr 17, 2016

I've submitted a pull request that fixes this issue in jpeg-js. I used a smaller version of your image (which displays the same behavior in jimp right now) as one of the test cases there.

If you want to test it yourself before that PR gets merged and released, and then jimp has another release cycle, you can play with it by making this change to your own local dependency:

https://github.com/eugeneware/jpeg-js/pull/16/files#diff-f8ef8b8e3a0bcafb6e68ba4a7051a503

If you're curious to try it on the web, I've built the browser demo of jimp with that change. Yesterday, your test image looked like a black rectangle. Today, it works!

Yesterday:

image

Today:

image

Demo

http://strandedcity.github.io/jimp/browser/

@canvas-manik
Copy link

Thankyou Stranded City for your help. This is a great improvement.

Can we have a solution for Image colors getting lost as well.

@strandedcity
Copy link
Contributor

You mean color profiles? That's harder.

The black and white image there is just part of the web-browser demo. The image is read into Jimp in full CMYK. If you modify your local copy of jpeg-js according to https://github.com/eugeneware/jpeg-js/pull/16/files#diff-f8ef8b8e3a0bcafb6e68ba4a7051a503, Jimp will work with CMYK jpegs.

@strandedcity
Copy link
Contributor

Fixed as of #125 by including jpeg-js/jpeg-js#16

@canvasmanager can you re-run your test with current code (v0.2.22) and let me know if you still see any issues?

@oliver-moran
Copy link
Collaborator

Happy days. This will be in the next release. Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants