+ 17

Rendering image Blob file in canvas !

I was trying to take user input of image and display ot to canvas but I am not able to do it. see my try ­čĹç Please tell me the solution. https://code.sololearn.com/Wvy83fqvrS02/?ref=app

22nd Sep 2021, 4:05 PM
Ayush Kumar
Ayush Kumar - avatar
4 odpowiedzi
+ 6
You have to wait for the image to load before embedding it into the canvas. img.onload = function(){ ctx.drawImage(img,0,0,400,400); in_im.remove(); } https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Using_images#creating_an_image_from_scratch https://code.sololearn.com/WUmPMmQZ9N7s
22nd Sep 2021, 7:28 PM
ODLNT - avatar
+ 5
ńŞ╣ÔôĘŃäę┌ęň╗ż i think so u should try to append in_im and remove when clicked edit: without appending it won't work so try this document.body.append(in_im) in_im.click(); document.body.remove(in_im )
22nd Sep 2021, 4:31 PM
Pariket Thakur
Pariket Thakur - avatar
23rd Sep 2021, 3:09 AM
Nor'wester ­čŞĆ ­čçž­čçę (INACTIVE)
Nor'wester ­čŞĆ ­čçž­čçę (INACTIVE) - avatar
+ 3
That's not the actual problem. See the problem is to create image on canvas taking it from devise Time Is Money
22nd Sep 2021, 6:47 PM
Ayush Kumar
Ayush Kumar - avatar