JPG to PNG Converter – Convert All Photos
Upload JPG → Auto Convert → Download Individually OR Download All.
100% Secure – Works in Browser Only.
or Click to Upload
let drop=document.getElementById("drop"); let fileInput=document.getElementById("fileInput"); let list=document.getElementById("list"); let done=document.getElementById("done"); let zip=new JSZip(); let total=0,completed=0;
drop.onclick=()=>fileInput.click();
drop.addEventListener("dragover",e=>{ e.preventDefault(); drop.style.borderColor="#16a34a"; });
drop.addEventListener("dragleave",()=>{ drop.style.borderColor="#999"; });
drop.addEventListener("drop",e=>{ e.preventDefault(); handle(e.dataTransfer.files); });
fileInput.onchange=()=>handle(fileInput.files);
function handle(files){ files=[...files]; let valid=files.filter(f=>f.type.includes("image")); if(!valid.length){alert("Only JPG images allowed");return;} total=valid.length; list.innerHTML=""; valid.forEach(f=>createCard(f)); }
function createCard(file){ let id=Date.now()+Math.random(); let box=document.createElement("div"); box.className="fileBox"; box.innerHTML=` ${file.name}
Converting...
Download PNG `; list.appendChild(box); convert(file,id); }
function convert(file,id){ let bar=document.getElementById("bar"+id); let text=document.getElementById("text"+id); let btn=document.getElementById("btn"+id);
let fake=0; let loading=setInterval(()=>{ fake+=15; bar.style.width=fake+"%"; if(fake>=100){ clearInterval(loading); process(file,id,btn,text); } },120); }
function process(file,id,btn,text){ let reader=new FileReader(); reader.onload=e=>{ let img=new Image(); img.src=e.target.result; img.onload=()=>{ let c=document.createElement("canvas"); c.width=img.width; c.height=img.height; let ctx=c.getContext("2d"); ctx.drawImage(img,0,0);
let png=c.toDataURL("image/png"); let name="converted-"+Date.now()+".png";
btn.href=png; btn.download=name; btn.classList.remove("hide");
zip.file(name,png.split("base64,")[1],{base64:true});
text.innerHTML="Done ✔️"; completed++;
if(completed===total)done.classList.remove("hide"); } } reader.readAsDataURL(file); }
document.getElementById("downloadAll").onclick=()=>{ zip.generateAsync({type:"blob"}).then(zipFile=>{ let a=document.createElement("a"); a.href=URL.createObjectURL(zipFile); a.download="ALL-PNG.zip"; a.click(); }); }