{"action":"created","issue":{"url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/147","labels_url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/147/comments","events_url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/147/events","html_url":"https://github.com/haraldk/TwelveMonkeys/issues/147","id":90654280,"number":147,"title":"CMYK image loading with inverted colors","user":{"login":"maciejhirsz","id":1096222,"avatar_url":"https://avatars.githubusercontent.com/u/1096222?v=3","gravatar_id":"","url":"https://api.github.com/users/maciejhirsz","html_url":"https://github.com/maciejhirsz","followers_url":"https://api.github.com/users/maciejhirsz/followers","following_url":"https://api.github.com/users/maciejhirsz/following{/other_user}","gists_url":"https://api.github.com/users/maciejhirsz/gists{/gist_id}","starred_url":"https://api.github.com/users/maciejhirsz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maciejhirsz/subscriptions","organizations_url":"https://api.github.com/users/maciejhirsz/orgs","repos_url":"https://api.github.com/users/maciejhirsz/repos","events_url":"https://api.github.com/users/maciejhirsz/events{/privacy}","received_events_url":"https://api.github.com/users/maciejhirsz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-24T11:49:47Z","updated_at":"2015-07-03T20:31:59Z","closed_at":null,"body":"I've been using TwelveMonkeys for a while without much of an issue, but of course finally some client managed to fabricate an image that doesn't load quite right, it's the first CMYK image that I see load with inverted colors, and I'm a bit at a loss why...\r\n\r\nThe JPEG in question to be found here: http://terhix.com/inverted.jpg\r\n\r\nImageMagick `identify -verbose` dump:\r\n\r\n```\r\nImage: inverted.jpg\r\n  Format: JPEG (Joint Photographic Experts Group JFIF format)\r\n  Mime type: image/jpeg\r\n  Class: DirectClass\r\n  Geometry: 796x1194+0+0\r\n  Resolution: 28.3465x28.3465\r\n  Print size: 28.0811x42.1216\r\n  Units: PixelsPerCentimeter\r\n  Type: ColorSeparation\r\n  Endianess: Undefined\r\n  Colorspace: CMYK\r\n  Depth: 8-bit\r\n  Channel depth:\r\n    cyan: 8-bit\r\n    magenta: 8-bit\r\n    yellow: 8-bit\r\n    black: 8-bit\r\n  Channel statistics:\r\n    Pixels: 950424\r\n    Cyan:\r\n      min: 0 (0)\r\n      max: 255 (1)\r\n      mean: 77.9501 (0.305687)\r\n      standard deviation: 52.9279 (0.207561)\r\n      kurtosis: -0.987192\r\n      skewness: 0.00923395\r\n      entropy: 0.882891\r\n    Magenta:\r\n      min: 0 (0)\r\n      max: 255 (1)\r\n      mean: 87.5529 (0.343345)\r\n      standard deviation: 58.1934 (0.228209)\r\n      kurtosis: -0.841658\r\n      skewness: -0.150388\r\n      entropy: 0.867921\r\n    Yellow:\r\n      min: 0 (0)\r\n      max: 255 (1)\r\n      mean: 131.115 (0.514175)\r\n      standard deviation: 87.8883 (0.34466)\r\n      kurtosis: -1.45162\r\n      skewness: -0.131165\r\n      entropy: 0.927241\r\n    Black:\r\n      min: 0 (0)\r\n      max: 255 (1)\r\n      mean: 55.7855 (0.218767)\r\n      standard deviation: 60.2406 (0.236238)\r\n      kurtosis: -0.661707\r\n      skewness: 0.7945\r\n      entropy: 0.775388\r\n  Image statistics:\r\n    Overall:\r\n      min: 0 (0)\r\n      max: 255 (1)\r\n      mean: 88.1008 (0.345493)\r\n      standard deviation: 66.2214 (0.259692)\r\n      kurtosis: 0.129288\r\n      skewness: 0.564087\r\n      entropy: 0.86336\r\n  Total ink density: 372.157%\r\n  Rendering intent: Perceptual\r\n  Gamma: 0.454545\r\n  Chromaticity:\r\n    red primary: (0.64,0.33)\r\n    green primary: (0.3,0.6)\r\n    blue primary: (0.15,0.06)\r\n    white point: (0.3127,0.329)\r\n  Background color: cmyk(255,255,255,0)\r\n  Border color: cmyk(223,223,223,0)\r\n  Matte color: cmyk(189,189,189,0)\r\n  Transparent color: cmyk(0,0,0,0)\r\n  Interlace: None\r\n  Intensity: Undefined\r\n  Compose: Over\r\n  Page geometry: 796x1194+0+0\r\n  Dispose: Undefined\r\n  Iterations: 0\r\n  Compression: JPEG\r\n  Quality: 78\r\n  Orientation: TopLeft\r\n  Properties:\r\n    date:create: 2015-06-24T13:46:51+02:00\r\n    date:modify: 2015-06-24T13:46:46+02:00\r\n    exif:ApertureValue: 327680/65536\r\n    exif:BitsPerSample: 8, 8, 8, 8\r\n    exif:ColorSpace: 65535\r\n    exif:Compression: 5\r\n    exif:DateTime: 2015:02:12 10:13:55\r\n    exif:DateTimeDigitized: 2016:07:12 08:37:36\r\n    exif:DateTimeOriginal: 2016:07:12 08:37:36\r\n    exif:ExifImageLength: 1194\r\n    exif:ExifImageWidth: 796\r\n    exif:ExifOffset: 312\r\n    exif:ExifVersion: 48, 50, 50, 48\r\n    exif:ExposureBiasValue: 0/1\r\n    exif:ExposureMode: 1\r\n    exif:ExposureProgram: 1\r\n    exif:ExposureTime: 1/250\r\n    exif:FileSource: 3\r\n    exif:Flash: 16\r\n    exif:FNumber: 56/10\r\n    exif:FocalLength: 88/1\r\n    exif:FocalPlaneResolutionUnit: 2\r\n    exif:ImageLength: 6739\r\n    exif:ImageWidth: 4493\r\n    exif:ISOSpeedRatings: 200\r\n    exif:Make: Canon\r\n    exif:MeteringMode: 5\r\n    exif:Model: Canon EOS-1Ds Mark III\r\n    exif:Orientation: 1\r\n    exif:PhotometricInterpretation: 5\r\n    exif:PlanarConfiguration: 1\r\n    exif:ResolutionUnit: 3\r\n    exif:SamplesPerPixel: 4\r\n    exif:SceneType: 1\r\n    exif:ShutterSpeedValue: 524288/65536\r\n    exif:Software: Adobe Photoshop CS5.1 Windows\r\n    exif:SubjectDistance: 0/1\r\n    exif:thumbnail:Compression: 6\r\n    exif:thumbnail:JPEGInterchangeFormat: 806\r\n    exif:thumbnail:JPEGInterchangeFormatLength: 7607\r\n    exif:thumbnail:ResolutionUnit: 2\r\n    exif:thumbnail:XResolution: 72/1\r\n    exif:thumbnail:YResolution: 72/1\r\n    exif:WhiteBalance: 0\r\n    exif:XResolution: 283465/10000\r\n    exif:YResolution: 283465/10000\r\n    jpeg:colorspace: 4\r\n    jpeg:sampling-factor: 2x2,1x1,1x1,2x2\r\n    signature: f79ef5e4bdbc0d1b087a48b9f1c690ac172e2c30ae7370ec29aed49aa738a1df\r\n  Profiles:\r\n    Profile-8bim: 9904 bytes\r\n    Profile-exif: 8419 bytes\r\n    Profile-icc: 1052608 bytes\r\n    Profile-iptc: 139 bytes\r\n      unknown[1,0]: \r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      City[1,90]: 0x00000000: 254700                                        -%\r\n      unknown[2,0]: \r\n      Created Date[2,55]: 20160712\r\n      Created Time[2,60]: 083736+0200\r\n    Profile-xmp: 5100 bytes\r\n  Artifacts:\r\n    filename: inverted.jpg\r\n    verbose: true\r\n  Tainted: False\r\n  Filesize: 1.159MB\r\n  Number pixels: 950K\r\n  Pixels per second: 237.61GB\r\n  User time: 0.000u\r\n  Elapsed time: 0:01.000\r\n  Version: ImageMagick 6.9.1-1 Q16 x86_64 2015-04-15 http://www.imagemagick.org\r\n```\r\n\r\nTested with TwelveMonkeys 3.1.1."},"comment":{"url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/comments/118421575","html_url":"https://github.com/haraldk/TwelveMonkeys/issues/147#issuecomment-118421575","issue_url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/147","id":118421575,"user":{"login":"haraldk","id":110299,"avatar_url":"https://avatars.githubusercontent.com/u/110299?v=3","gravatar_id":"","url":"https://api.github.com/users/haraldk","html_url":"https://github.com/haraldk","followers_url":"https://api.github.com/users/haraldk/followers","following_url":"https://api.github.com/users/haraldk/following{/other_user}","gists_url":"https://api.github.com/users/haraldk/gists{/gist_id}","starred_url":"https://api.github.com/users/haraldk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haraldk/subscriptions","organizations_url":"https://api.github.com/users/haraldk/orgs","repos_url":"https://api.github.com/users/haraldk/repos","events_url":"https://api.github.com/users/haraldk/events{/privacy}","received_events_url":"https://api.github.com/users/haraldk/received_events","type":"User","site_admin":false},"created_at":"2015-07-03T20:31:59Z","updated_at":"2015-07-03T20:31:59Z","body":"Okay, found the issue (it was the experimental code I expected). I'll have to revert some code for this to display correctly (and it will break some other images). \r\n\r\nThe main problem here is that CMYK JPEG isn't very strictly defined AFAIK. The \"de facto\" way is to treat stand-alone CMYK JPEGs as stored inverted, while CMYK JPEG streams inside PDFs are normally stored non-inverted. However this is not always correct...\r\n\r\nDo you know what software created this image? Is it extracted from a PDF?\r\n\r\nRegards,\r\n\r\n-- \r\nHarald K\r\n"}}