1j01 / jspaint

🎨 Classic MS Paint, REVIVED + ✨Extras
https://jspaint.app/about
MIT License
7.17k stars 562 forks source link

Unable to save a PNG file #272

Closed drbulba closed 1 year ago

drbulba commented 2 years ago

I have recently been unable to save PNG files in JSPaint. I am unsure whether it is my pc, browser, files, or JSPaint itself. (Image trying to save is larger than starting canvas)

lafoxxx92 commented 2 years ago

Unable to reproduce. Screen Shot 2022-01-09 at 14 53 19 Screen Shot 2022-01-09 at 14 53 22 Screen Shot 2022-01-09 at 14 53 35 Screen Shot 2022-01-09 at 14 53 49

lafoxxx92 commented 2 years ago

What Browser/OS (and which versions) do you use? Step-by-step description possible?

drbulba commented 2 years ago

this also happens on Opera/Windows, dunno what its about

On Fri, Jan 21, 2022 at 6:30 PM Valerii Zapodovnikov < @.***> wrote:

Remove the block on multiple downloads in Chrome.

— Reply to this email directly, view it on GitHub https://github.com/1j01/jspaint/issues/272#issuecomment-1018948497, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXG6SSRKVQ6BLS4CAUKKTGLUXHT73ANCNFSM5LRSFD6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

drbulba commented 2 years ago

alright, Mr/Mrs. Zapodovnikov. no need to be sassy.

On Mon, Jan 24, 2022 at 12:03 AM Valerii Zapodovnikov < @.***> wrote:

Opera/Windows, dunno

Opera is also chrome. 🙄

— Reply to this email directly, view it on GitHub https://github.com/1j01/jspaint/issues/272#issuecomment-1019722293, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXG6SSW4WJE35QTTD3IQ5FDUXTMSZANCNFSM5LRSFD6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

nouraellm commented 2 years ago

I use Chrome/MacOs monetary

ReferenceError: UZIP is not defined
    at Function.UPNG.encode._filterZero (https://jspaint.app/lib/UPNG.js:802:34)
    at Function.UPNG.encode.compressPNG (https://jspaint.app/lib/UPNG.js:574:26)
    at Object.UPNG.encode (https://jspaint.app/lib/UPNG.js:434:14)
    at write_image_file (https://jspaint.app/src/functions.js:3361:29)
    at https://jspaint.app/src/functions.js:1046:5
    at new Promise (<anonymous>)
    at getBlob (https://jspaint.app/src/functions.js:1045:11)
    at Object.showSaveFileDialog (https://jspaint.app/src/app.js:259:23)
sabrt00th commented 1 year ago

Also getting this issue in 2023. Using Chrome v108.0.5359.124 and macOS Monterey v12.5.1.

Internal application error.
Unhandled Rejection. 

ReferenceError: UZIP is not defined
    at UPNG.encode._filterZero (https://jspaint.app/lib/UPNG.js:802:34)
    at UPNG.encode.compressPNG (https://jspaint.app/lib/UPNG.js:574:26)
    at UPNG.encode (https://jspaint.app/lib/UPNG.js:434:14)
    at write_image_file (https://jspaint.app/src/functions.js:3365:29)
    at https://jspaint.app/src/functions.js:1047:5
    at new Promise (<anonymous>)
    at getBlob (https://jspaint.app/src/functions.js:1046:11)
    at Object.showSaveFileDialog (https://jspaint.app/src/app.js:260:23)

Doesn't seem to affect all canvasses equally, as a freshly generated piece with a few random brushstrokes doesn't trigger it, but the 0.9 MB png file I imported to edit on JSpaint does.

Would greatly appreciate at least some kind of response from Isaiah regarding this, though seeing as their last commit to anything on Github was more than 2 months ago, I'ven't the highest of hopes.

1j01 commented 1 year ago

Saving large PNG files should be working now.

It was a bug in UPNG.js. The line with the error tells the story:

    var CMPR = (data.length>10e6 && UZIP!=null) ? UZIP : pako;

For image data larger than 10e6 (assuming bytes, that's 10 MB), it looked for an optional dependency UZIP, incorrectly. Checking if UZIP!=null actually throws an error if UZIP isn't defined; it should use typeof to safely check for a global.