snorpey / jpg-glitch

glitch images with jpg encoding
http://snorpey.github.io/jpg-glitch/
MIT License
1.2k stars 96 forks source link

Export fails with large image #4

Open belzecue opened 11 years ago

belzecue commented 11 years ago

Probably not unexpectedly, exporting fails with a large image. Try: https://iammadeofrobots.files.wordpress.com/2013/09/asianeyes.jpg

snorpey commented 11 years ago

thank you for reporing this.

since this seems to work fine for me on firefox and chrome on windows, so i suspect it is a hardware or operating system related issue.

@belzecue can can you provide a bit more info about the operating system and browser used (and if possible details about the hardware?)

thank you! :bowtie:

belzecue commented 11 years ago

Win7 64-bit, AMD X4 640, 8gig ram.

At the time, I tried in Firefox after it failed in Chrome and it appeared to fail also, but I think I didn't wait long enough -- on another attempt with Firefox just now with the same large pic it exported okay after a delay of 10 seconds before the save dialog pops up. But I can load smaller pics and export them fine. Tested again just now and the big one continues to crash the tab ("aw snap"). More Chrome testing: incognito window, still crashes; clean profile (freshly generated, no plugins), still crashes with the same large pic.

snorpey commented 11 years ago

thank you for testing! i'll look into this issue a bit further and hopefully i'll be able to reproduce and/or hopefully fix it (or maybe show a warning of some kind when the user is importing a large file).

snorpey commented 11 years ago

I just did some more research on this, and apparently the exported image cannot be larger than 2MB in Chrome, 128KB in Safari and 32 KB in some IE versions ( http://stackoverflow.com/a/6167680/229189 ).

So it looks like the only way to fix this is to set a size limit for the canvas. All images that are larger than the maximum size will get scaled down automatically.