Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to convert 31MB file in Firefox #13

Open
nomisum opened this issue May 17, 2021 · 3 comments
Open

Failed to convert 31MB file in Firefox #13

nomisum opened this issue May 17, 2021 · 3 comments
Labels
file conversion failed Attached file couldn't be converted. wontfix This will not be worked on

Comments

@nomisum
Copy link
Contributor

nomisum commented May 17, 2021

[Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: https://paa2.gruppe-adler.de/main.65faf26e.js :: k/< :: line 2" data: no]

paa.gruppe-adler.de couldn't convert my file.

  • OS: Win10
  • Browser Firefox
  • Version 88.0.1
    Filesize is 13312 x 13312px

File too large to attach, will be sent via Discord

@nomisum nomisum added the file conversion failed Attached file couldn't be converted. label May 17, 2021
@DerZade
Copy link
Member

DerZade commented May 17, 2021

Works as expected in Opera, Chrome and Edge. All three browsers show the "Dimensions have to be power of two" warning.

So I guess this is Firefox specific. I'll look into it :D

@DerZade DerZade changed the title [CONVERSION FAILED] [CONVERSION FAILED] 31MB file in Firefox May 17, 2021
@DerZade DerZade changed the title [CONVERSION FAILED] 31MB file in Firefox 31MB file in Firefox May 17, 2021
@DerZade DerZade changed the title 31MB file in Firefox Failed to convert 31MB file in Firefox May 17, 2021
@DerZade
Copy link
Member

DerZade commented May 18, 2021

Seems like Firefox can't handle CanvasRenderingContext2D.getImageData() on big canvases.

I couldn't find a bug report or anything, but could validate the behavior with this simple code:

<canvas id="canvas" />
const DIMENSIONS = 30000;

const canvas = document.getElementById('canvas');

canvas.width = DIMENSIONS;
canvas.height = DIMENSIONS;

const ctx = canvas.getContext('2d');
const data = ctx.getImageData(0, 0, 1, 1);

console.log(data);

(There is also a jsfiddle)

In Firefox 88.0.1 it worked up to a canvas size of 11180x11180. Everything bigger just failed with { name: "NS_ERROR_FAILURE" [...] result: 2147500037 }.

@DerZade
Copy link
Member

DerZade commented May 18, 2021

I did some more research. The only broadly related issue I found was this. Users got a similar error, when trying to take a large screenshot via Firefox DevTools.

The limitations as pointed out by one user are:

  • one dimension is larger than 32767 (which is 2¹⁵ - 1 or the upper limit of a 16 Bit number as two's complement)
  • more than a total of 125,000,000 pixels (or 500MB if 4 bytes per RGBA pixel)

I guess the same limitations apply to our use case.


Sadly there is not much we can do about those limitations (at least not without much overhead).
This sets our upper limit of applicable images for paa.gruppe-adler.de in Firefox to dimensions of 8192x8192 pixels.

@DerZade DerZade added the wontfix This will not be worked on label May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file conversion failed Attached file couldn't be converted. wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants