{"action":"created","issue":{"url":"https://api.github.com/repos/ccorcos/meteor-clientside-image-manipulation/issues/11","labels_url":"https://api.github.com/repos/ccorcos/meteor-clientside-image-manipulation/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/ccorcos/meteor-clientside-image-manipulation/issues/11/comments","events_url":"https://api.github.com/repos/ccorcos/meteor-clientside-image-manipulation/issues/11/events","html_url":"https://github.com/ccorcos/meteor-clientside-image-manipulation/issues/11","id":113887870,"number":11,"title":"Resize quality","user":{"login":"achirkof","id":1292136,"avatar_url":"https://avatars.githubusercontent.com/u/1292136?v=3","gravatar_id":"","url":"https://api.github.com/users/achirkof","html_url":"https://github.com/achirkof","followers_url":"https://api.github.com/users/achirkof/followers","following_url":"https://api.github.com/users/achirkof/following{/other_user}","gists_url":"https://api.github.com/users/achirkof/gists{/gist_id}","starred_url":"https://api.github.com/users/achirkof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/achirkof/subscriptions","organizations_url":"https://api.github.com/users/achirkof/orgs","repos_url":"https://api.github.com/users/achirkof/repos","events_url":"https://api.github.com/users/achirkof/events{/privacy}","received_events_url":"https://api.github.com/users/achirkof/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-28T18:15:18Z","updated_at":"2015-10-29T17:33:56Z","closed_at":null,"body":"Hello.\r\nGreat package. I tried this and it's very simple and useful. But if I compare quality between processImage with quality 1.0 and server side resizing using GraphicsMagick with quality 100%.\r\n![compare](http://i.imgur.com/1rMXoVE.png)\r\n\r\nSame image size but left image quality poor.\r\nIs it possible to increase quality of resized image?"},"comment":{"url":"https://api.github.com/repos/ccorcos/meteor-clientside-image-manipulation/issues/comments/152258965","html_url":"https://github.com/ccorcos/meteor-clientside-image-manipulation/issues/11#issuecomment-152258965","issue_url":"https://api.github.com/repos/ccorcos/meteor-clientside-image-manipulation/issues/11","id":152258965,"user":{"login":"ccorcos","id":1794527,"avatar_url":"https://avatars.githubusercontent.com/u/1794527?v=3","gravatar_id":"","url":"https://api.github.com/users/ccorcos","html_url":"https://github.com/ccorcos","followers_url":"https://api.github.com/users/ccorcos/followers","following_url":"https://api.github.com/users/ccorcos/following{/other_user}","gists_url":"https://api.github.com/users/ccorcos/gists{/gist_id}","starred_url":"https://api.github.com/users/ccorcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccorcos/subscriptions","organizations_url":"https://api.github.com/users/ccorcos/orgs","repos_url":"https://api.github.com/users/ccorcos/repos","events_url":"https://api.github.com/users/ccorcos/events{/privacy}","received_events_url":"https://api.github.com/users/ccorcos/received_events","type":"User","site_admin":false},"created_at":"2015-10-29T17:33:56Z","updated_at":"2015-10-29T17:33:56Z","body":"Ok. I did a little work for you -- you'll need to test it out though.\r\n\r\n```\r\ndownsize = (img, [targetWidth, targetHeight]) ->\r\n  if img.width/targetWidth > 2 or img.height/targetHeight > 2\r\n    canvas = document.createElement('canvas')\r\n    ctx = canvas.getContext(\"2d\")\r\n    ctx.drawImage img, 0, 0, img.width/2, img.height/2\r\n    newImg = ctx.getImageData(0, 0, img.width/2, img.height/2)\r\n    return downsize(newImg, [targetWidth, targetHeight])\r\n  else\r\n    canvas = document.createElement('canvas')\r\n    ctx = canvas.getContext(\"2d\")\r\n    ctx.drawImage img, 0, 0, img.width/2, img.height/2\r\n    return newImg = ctx.getImageData(0, 0, targetWidth, targetHeight)\r\n```\r\n\r\nBasically just recursively downsize ensuring that you never downsize by more than 1/2 each step. \r\n\r\nTo develop, just do this:\r\n\r\n```\r\ngit clone https://github.com/ccorcos/meteor-clientside-image-manipulation.git ccorcos:clientside-image-manipulation\r\ncd ccorcos:clientside-image-manipulation\r\ncd example\r\nmeteor\r\n```\r\n\r\nEdit the code and you should be good to go testing with the example app."}}