I am using the toDataURL method of FabricJS with a multiplier. However, when I try to download and open the file, in paint for example, it throws the following error:
This is not a valid bitmap file, or its format is not currently supported
However, if I don't use the multiplier, it works. I am using Chrome and my dimensions when multiplied are 11610 x 7800 (initially it is 774 x 520) so it is within the bounds stated here: Maximum size of a <canvas> element
Here is my canvas HTML:
<canvas id ="c"></canvas>
Here is my canvas creation JavaScript:
var canvas = new fabric.Canvas('c', {
});
canvas.setWidth(774);
canvas.setHeight(520);
Example 1: No multiplier (works):
var img = canvas.toDataURL({
format: "png",
});
document.write('<img src="' + img + '"/>');
Example 2: Multiplier (doesn't work/bitmap error):
var img = canvas.toDataURL({
format: "png",
multiplier: 15
});
document.write('<img src="' + img + '"/>');
Update:
This appears to only be happening with files that have a dimension larger than 10,000 pixels.