{"action":"created","issue":{"url":"https://api.github.com/repos/dimensio/icc/issues/1","repository_url":"https://api.github.com/repos/dimensio/icc","labels_url":"https://api.github.com/repos/dimensio/icc/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/dimensio/icc/issues/1/comments","events_url":"https://api.github.com/repos/dimensio/icc/issues/1/events","html_url":"https://github.com/dimensio/icc/issues/1","id":155224642,"number":1,"title":"Questions","user":{"login":"homerjam","id":1055769,"avatar_url":"https://avatars.githubusercontent.com/u/1055769?v=3","gravatar_id":"","url":"https://api.github.com/users/homerjam","html_url":"https://github.com/homerjam","followers_url":"https://api.github.com/users/homerjam/followers","following_url":"https://api.github.com/users/homerjam/following{/other_user}","gists_url":"https://api.github.com/users/homerjam/gists{/gist_id}","starred_url":"https://api.github.com/users/homerjam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/homerjam/subscriptions","organizations_url":"https://api.github.com/users/homerjam/orgs","repos_url":"https://api.github.com/users/homerjam/repos","events_url":"https://api.github.com/users/homerjam/events{/privacy}","received_events_url":"https://api.github.com/users/homerjam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-17T10:18:54Z","updated_at":"2016-05-17T11:20:45Z","closed_at":null,"body":"Hi Lovell\r\n\r\nA question/some advice if you don't mind!\r\n\r\nI'm using https://github.com/blueimp/JavaScript-Load-Image to resize images client side for upload. After resizing I'm adding the metadata back to the image for upload. This works great for RGB images, however it's not working with CMYK images - the result has an invalid ICC profile.\r\n\r\n![cmyk-invalid-icc](https://cloud.githubusercontent.com/assets/1055769/15319070/ee2295e4-1c20-11e6-9e4b-a8dc580268ab.jpg)\r\n\r\nWhat I'd like to do is flag to the uploader images which are not RGB - the best way to do this is by examining the ICC profile (EXIF colorspace data is simply not reliable as far as I can tell). Having looked at this lib I think it could be used in the browser however I still face the issue of extracting the ICC profile from the metadata/header/image in the first place.\r\n\r\nSo my question - is there a way this lib could be made to work with an image rather than a raw profile? I'm thinking there may be some clues here http://www.littlecms.com/1/iccjpeg.c. Or do you know how one might extract the ICC profile from an image in the browser?\r\n\r\nMany thanks for your time\r\n\r\nJames\r\n"},"comment":{"url":"https://api.github.com/repos/dimensio/icc/issues/comments/219689502","html_url":"https://github.com/dimensio/icc/issues/1#issuecomment-219689502","issue_url":"https://api.github.com/repos/dimensio/icc/issues/1","id":219689502,"user":{"login":"lovell","id":210965,"avatar_url":"https://avatars.githubusercontent.com/u/210965?v=3","gravatar_id":"","url":"https://api.github.com/users/lovell","html_url":"https://github.com/lovell","followers_url":"https://api.github.com/users/lovell/followers","following_url":"https://api.github.com/users/lovell/following{/other_user}","gists_url":"https://api.github.com/users/lovell/gists{/gist_id}","starred_url":"https://api.github.com/users/lovell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lovell/subscriptions","organizations_url":"https://api.github.com/users/lovell/orgs","repos_url":"https://api.github.com/users/lovell/repos","events_url":"https://api.github.com/users/lovell/events{/privacy}","received_events_url":"https://api.github.com/users/lovell/received_events","type":"User","site_admin":false},"created_at":"2016-05-17T11:20:45Z","updated_at":"2016-05-17T11:20:45Z","body":"In JPEG images, ICC profiles are stored in one or more `APP2` markers.\r\n\r\nLooking at the source of `JavaScript-Load-Image`, my best guess would be to handle this by adding to [metaDataParsers](https://github.com/blueimp/JavaScript-Load-Image/blob/master/js/load-image-meta.js#L40).\r\n\r\n`icc` should be able to parse enough from the first `APP2` to detect CMYK vs whatever, but you might need to concatenate multiple occurrences of APP2 marker data into a single Buffer first.\r\n\r\nI notice there's a [256 KiB](https://github.com/blueimp/JavaScript-Load-Image/blob/master/js/load-image-meta.js#L55) limit. This is probably not enough to \"contain all EXIF/ICC/IPTC segments\" given CMYK ICC profiles are ~540KiB."}}