{"action":"created","issue":{"url":"https://api.github.com/repos/agschwender/pilbox/issues/29","labels_url":"https://api.github.com/repos/agschwender/pilbox/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/agschwender/pilbox/issues/29/comments","events_url":"https://api.github.com/repos/agschwender/pilbox/issues/29/events","html_url":"https://github.com/agschwender/pilbox/issues/29","id":53705152,"number":29,"title":"Error \"encoder error -2 when writing image file\" occurs for some JPEG images","user":{"login":"xtagon","id":47229,"avatar_url":"https://avatars.githubusercontent.com/u/47229?v=3","gravatar_id":"","url":"https://api.github.com/users/xtagon","html_url":"https://github.com/xtagon","followers_url":"https://api.github.com/users/xtagon/followers","following_url":"https://api.github.com/users/xtagon/following{/other_user}","gists_url":"https://api.github.com/users/xtagon/gists{/gist_id}","starred_url":"https://api.github.com/users/xtagon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtagon/subscriptions","organizations_url":"https://api.github.com/users/xtagon/orgs","repos_url":"https://api.github.com/users/xtagon/repos","events_url":"https://api.github.com/users/xtagon/events{/privacy}","received_events_url":"https://api.github.com/users/xtagon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-08T01:41:39Z","updated_at":"2015-01-08T18:20:51Z","closed_at":"2015-01-08T15:41:36Z","body":"Hi,\r\n\r\nI'm having a hard time troubleshooting this issue. Some of our images fail on Pilbox with the following error: `encoder error -2 when writing image file`\r\n\r\nI can't reproduce on my dev machine, but our Pilbox server running on Heroku exhibits the error. I realize this might be a Pillow or libjpeg error and not necessarily Pilbox, but if you could help me figure out next steps to debug this it would be greatly appreciated.\r\n\r\nWe're running Pilbox 1.1.3 and Python 3.4.1. Let me know what other info might be needed. Thanks!"},"comment":{"url":"https://api.github.com/repos/agschwender/pilbox/issues/comments/69223660","html_url":"https://github.com/agschwender/pilbox/issues/29#issuecomment-69223660","issue_url":"https://api.github.com/repos/agschwender/pilbox/issues/29","id":69223660,"user":{"login":"xtagon","id":47229,"avatar_url":"https://avatars.githubusercontent.com/u/47229?v=3","gravatar_id":"","url":"https://api.github.com/users/xtagon","html_url":"https://github.com/xtagon","followers_url":"https://api.github.com/users/xtagon/followers","following_url":"https://api.github.com/users/xtagon/following{/other_user}","gists_url":"https://api.github.com/users/xtagon/gists{/gist_id}","starred_url":"https://api.github.com/users/xtagon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtagon/subscriptions","organizations_url":"https://api.github.com/users/xtagon/orgs","repos_url":"https://api.github.com/users/xtagon/repos","events_url":"https://api.github.com/users/xtagon/events{/privacy}","received_events_url":"https://api.github.com/users/xtagon/received_events","type":"User","site_admin":false},"created_at":"2015-01-08T18:20:51Z","updated_at":"2015-01-08T18:20:51Z","body":"It's running on Heroku, and Heroku always directs STDOUT and STDERR to the logs. I tried adding `-u` to the Python command and set `PYTHONUNBUFFERED=True` in the ENV just in case there was a buffering issue ([suggested here](http://stackoverflow.com/questions/12504588/how-to-see-heroku-logging-and-runtime-error-output-in-python)) but I still don't see any more error details in the logs.\r\n\r\nAdditionally, we just now discovered by accident that if we add the rotate op it no longer produces the error.\r\n\r\n- `op=resize&mode=clip&filter=bilinear&opt=1&prog=1&q=keep&w=200` - FAIL (What we're trying to use)\r\n- `op=resize,rotate&deg=0&mode=clip&filter=bilinear&opt=1&prog=1&q=keep&w=200` - OK (no error)\r\n- `w=200` - OK (no error)\r\n\r\nIt's weird that adding the rotate op or removing other params stops the error. For now we can workaround by adding rotate with `deg=0` to everything."}}