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2MX6JoEADyHQ2J1YxeopYAAEQgAACQAATVqwhThSSk7xkJC9kNIgZDZITm6jRR2O0GxzL+EYxzvGMXEmjKlCBAQMgYAUUQIABrEDGO9pxjXTE4x3bSMcRCsUtaIxjIdOISDZOcoSoSARrNLlJTnbSk58EZShFOcpRasEBCrCCJxZBBQdpgZSvhGUsZfnKRJARFXpE3S1zeUtc7rKXquhlLnFkCUzUEVOXxfQlMoUZTGXycpfKNCYxTSEBAkjgE4xoAAGmcMxgGjOZxWQmN4c5TGF+s5vh/CU6wbnOY4LxJlcgQAQmYAEHHCAs7sSnxjDARQIoQHH5BGiRUKGFKlQBESMMKEQCAgA7
所以,它只会在您下载时更改
<a href="MY_CANVAS_URL" download="img">Download</a>
我需要将此图片重命名为
留在页面上
解?
答案 0 :(得分:1)
[已编辑:]
以下是如何生成使用下载属性加载画布dataURL的链接
// take in a filename and dataURL
// return a new anchor element with download attribute
function newDownloadAnchor(filename,dataURL) {
var anchor = document.createElement("a");
anchor.download = filename;
anchor.title = "Get the canvas";
anchor.href = dataURL;
return(anchor);
}
// get a referenct to the canvas
var canvas=document.getElementById("canvas");
// capture the canvas as a URL
var theURL=canvas.toDataURL();
// create a new anchor with download attribute
var newAnchor=newDownloadAnchor("myFile.png",theURL);
// append the new anchor to the DOM
var parent=document.getElementById("appendToThisId");
parent.appendChild(newAnchor);
您可以使用canvas在客户端将Gif转换为PNG
// create a temporary canvas
var canvas=document.createElement("canvas");
var ctx=canvas.getContext("2d");
// make the canvas the same size as the image
canvas.width=image.width;
canvas.height=image.height;
// draw the gif on the canvas
ctx.drawImage(image,0,0);
// save the canvas toDataURL – the default format is PNG
var pngDataURL = canvas.toDataURL();
这是代码和小提琴:http://jsfiddle.net/m1erickson/gZ87t/
此代码将gif转换为png并将其显示在img-tag中。
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="css/reset.css" /> <!-- reset css -->
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<style>
body{ background-color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iFtGIRxyiKj4xMyQ2MX6JoEADyHQ2J1YxeopYAAEQgAACQAATVqwhThSSk7xkJC9kNIgZDZITm6jRR2O0GxzL+EYxzvGMXEmjKlCBAQMgYAUUQIABrEDGO9pxjXTE4x3bSMcRCsUtaIxjIdOISDZOcoSoSARrNLlJTnbSk58EZShFOcpRasEBCrCCJxZBBQdpgZSvhGUsZfnKRJARFXpE3S1zeUtc7rKXquhlLnFkCUzUEVOXxfQlMoUZTGXycpfKNCYxTSEBAkjgE4xoAAGmcMxgGjOZxWQmN4c5TGF+s5vh/CU6wbnOY4LxJlcgQAQmYAEHHCAs7sSnxjDARQIoQHH5BGiRUKGFKlQBESMMKEQCAgA7";
convertGifToPng(gifDataURL,callback);
function convertGifToPng(gifURL,callback){
var image=new Image();
image.onload=function(){
var canvas=document.createElement("canvas");
var ctx=canvas.getContext("2d");
canvas.width=image.width;
canvas.height=image.height;
ctx.drawImage(image,0,0);
var pngDataURL = canvas.toDataURL();
callback(pngDataURL);
}
image.src=gifDataURL;
}
function callback(pngURL){
document.getElementById("theImage").src=pngURL;
console.log(pngURL);
}
}); // end $(function(){});
</script>
</head>
<body>
<img id="theImage"/>
</body>
</html>