Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert image with .png format to .jpg format in javascript Filereader?

I have developed web application,I am using File reader for pick the image,In that i have to convert the image .png format to .jpeg format.Please help me anyone to complete the task. Thanks in Advance.

like image 932
Marimuthu Avatar asked May 02 '14 11:05

Marimuthu


1 Answers

This is definitely possible through HTML5 canvas element. Just draw the image in a canvas. (Make the canvas element hidden if you want). Then use canvas.toDataURL("image/jpeg"); to get the Base64 notation of image in the required format.

Check out : http://davidwalsh.name/convert-canvas-image

like image 195
Abhas Tandon Avatar answered Oct 19 '22 18:10

Abhas Tandon