1

I am trying to load images from my canvas to fabric canvas using

fabric.Image.fromURL(hc.toDataURL(), 
               function(img) {
                    canvas.add(img);
               }
 );

But if I add a 25 MB image it doesn't load the image at all. However without using fabric js I was able to do that by copying canvas and putImageData.

Any suggestions on how to improve performance ?

Sherali Turdiyev
  • 1,745
  • 16
  • 29
graphics123
  • 1,191
  • 3
  • 20
  • 57
  • Fabric.js may not be optimized for such large images. However I am assuming that you won't need such very large sized images in your canvas in their actual quality. Why don't you resize the image data using a simple hidden canvas and then paint the resized data uri in fabric canvas. You may take some help from http://stackoverflow.com/questions/20958078/resize-base64-image-in-javascript-without-using-canvas (second answer) – Abhas Tandon Oct 13 '15 at 11:50
  • I do have a hidden canvas .Can we do something with this http://fabricjs.com/docs/fabric.Image.html#fromObject – graphics123 Oct 13 '15 at 12:58

1 Answers1

1

hc i.e. hidden canvas will be a reference to actual fabric canvas. so, it totally depends on how you load your hidden canvas. So, probably try to fix that part before coming to fabric rendering part.

Hope this clears.