{"action":"created","issue":{"url":"https://api.github.com/repos/EyalAr/lwip/issues/194","labels_url":"https://api.github.com/repos/EyalAr/lwip/issues/194/labels{/name}","comments_url":"https://api.github.com/repos/EyalAr/lwip/issues/194/comments","events_url":"https://api.github.com/repos/EyalAr/lwip/issues/194/events","html_url":"https://github.com/EyalAr/lwip/issues/194","id":111142439,"number":194,"title":"PNG format seems broken since 0.0.8","user":{"login":"gautaz","id":11046232,"avatar_url":"https://avatars.githubusercontent.com/u/11046232?v=3","gravatar_id":"","url":"https://api.github.com/users/gautaz","html_url":"https://github.com/gautaz","followers_url":"https://api.github.com/users/gautaz/followers","following_url":"https://api.github.com/users/gautaz/following{/other_user}","gists_url":"https://api.github.com/users/gautaz/gists{/gist_id}","starred_url":"https://api.github.com/users/gautaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gautaz/subscriptions","organizations_url":"https://api.github.com/users/gautaz/orgs","repos_url":"https://api.github.com/users/gautaz/repos","events_url":"https://api.github.com/users/gautaz/events{/privacy}","received_events_url":"https://api.github.com/users/gautaz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-13T09:29:34Z","updated_at":"2015-10-13T12:26:11Z","closed_at":null,"body":"Hello,\r\n\r\nI'm using lwip to generate image thumbnails.\r\nIn order to test my code, I'm comparing a generated thumbnail to a standard one in PNG format.\r\nEverything was fine since 0.0.8 on which my test raises an error.\r\n\r\nIn order to diagnose the issue, I have tried to compare the generated image with the standard one by  using [ImageMagick](http://www.imagemagick.org/script/index.php), I've got the following error:\r\n\r\n```\r\n11:17 $ LANG=C compare old.png new.png diff.png\r\ncompare: improper image header `new.png' @ error/png.c/ReadPNGImage/3921.\r\n11:27 $ compare --version\r\nVersion: ImageMagick 6.9.2-3 Q16 x86_64 2015-10-02 http://www.imagemagick.org\r\n```\r\n\r\n*new.png* is the newly created thumbnail produced by lwip 0.0.8.\r\n\r\nThis might be related to https://github.com/EyalAr/lwip/pull/165 but I am not sure whether this is an ImageMagick issue or an lwip one."},"comment":{"url":"https://api.github.com/repos/EyalAr/lwip/issues/comments/147700238","html_url":"https://github.com/EyalAr/lwip/issues/194#issuecomment-147700238","issue_url":"https://api.github.com/repos/EyalAr/lwip/issues/194","id":147700238,"user":{"login":"gautaz","id":11046232,"avatar_url":"https://avatars.githubusercontent.com/u/11046232?v=3","gravatar_id":"","url":"https://api.github.com/users/gautaz","html_url":"https://github.com/gautaz","followers_url":"https://api.github.com/users/gautaz/followers","following_url":"https://api.github.com/users/gautaz/following{/other_user}","gists_url":"https://api.github.com/users/gautaz/gists{/gist_id}","starred_url":"https://api.github.com/users/gautaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gautaz/subscriptions","organizations_url":"https://api.github.com/users/gautaz/orgs","repos_url":"https://api.github.com/users/gautaz/repos","events_url":"https://api.github.com/users/gautaz/events{/privacy}","received_events_url":"https://api.github.com/users/gautaz/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T12:26:11Z","updated_at":"2015-10-13T12:26:11Z","body":"In the meantime, I have reinstalled lwip 0.0.7 to work around the issue and reinstalled lwip 0.0.8 back again to reproduce the failing sample.\r\nAnd now, I can just not reproduce the issue. What is bugging me is that before reinstalling, the issue was reproducible.\r\nI still have this difference between the old PNG sample and the new one but now ImageMagick accepts it without complaining.\r\n\r\nThe original image I'm using to operate my tests is available [here](http://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-56240.jpg).\r\n\r\nHere are both thumbnails produced by lwip 0.0.7 and 0.0.8:\r\n![thumbnail3-0 0 7](https://cloud.githubusercontent.com/assets/11046232/10454250/9a9276d2-71b3-11e5-8580-10fb976ac3d5.png) ![thumbnail3-0 0 8](https://cloud.githubusercontent.com/assets/11046232/10454255/a07d616a-71b3-11e5-8cae-3c1332778db8.png)\r\n\r\nAnd here is the difference that ImageMagick is now accepting to produce:\r\n![diff](https://cloud.githubusercontent.com/assets/11046232/10454273/c074dcb4-71b3-11e5-934a-ee4df4bf0eb2.png)\r\n\r\nThe source code I'm using to produce thumbnails:\r\n```\r\nvar storeImageAsIcon = function (buffer, format, callback) {\r\n\tlwip.open(buffer, format, function (err, image) {\r\n\t\tif (err) { return callback(err); }\r\n\t\tvar width = Math.ceil(50 * image.width() / image.height());\r\n\r\n\t\timage.resize(width, 50, function (err, image) {\r\n\t\t\tif (err) { return callback(err); }\r\n\r\n\t\t\timage.toBuffer('png', function (err, buffer) {\r\n\t\t\t\tif (err) { return callback(err); }\r\n\t\t\t\tvar writestream = gfs().createWriteStream({\r\n\t\t\t\t\tmetadata: { type: 'icon' },\r\n\t\t\t\t\tchunk_size: 1024,\r\n\t\t\t\t\tcontent_type: 'image/png'\r\n\t\t\t\t});\r\n\t\t\t\twritestream.on('close', function (file) {\r\n\t\t\t\t\tlog.info('icon', file._id, 'stored');\r\n\t\t\t\t\treturn callback(null, file._id);\r\n\t\t\t\t});\r\n\t\t\t\tstreamifier.createReadStream(buffer).pipe(writestream);\r\n\t\t\t});\r\n\t\t});\r\n\t});\r\n};\r\n```\r\n\r\nAs you can see, the only metadata I'm manipulating is for [gridfs](http://docs.mongodb.org/manual/core/gridfs/) and not for lwip.\r\n\r\nI have tried with a bunch of other images and I still cannot reproduce the issue, sorry.\r\nIf you cannot reproduce on your side, I will just close the issue..."}}