纯HTML代码实现给图片增加水印并下载保存到本地

发布时间:2023年12月24日

在这里插入图片描述

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>图片水印打码工具-宋佳乐博客</title>
    <style>
        #container {
            max-width: 500px;
            margin: 30px auto;
        }

        h1 { margin: 0 }
        p, article { margin: 0 0 20px 0 }
        article { font-size: 14px; color: #777 }

        label { color: blue; font-size: 17px }
        p label { color: black; display: inline-block; width: 50px; font-size: 15px }
        p { font-size: 15px; line-height: 30px }

        input#text { width: 100%; box-sizing: border-box; font-size: 16px; margin-bottom: 10px }
        input[type=range] { width: 200px; height: 18px; vertical-align: text-bottom }

        canvas { box-sizing: border-box; width: 100%; border: 1px dashed #AAA; cursor: pointer }
    </style>
</head>
    <div id="container">
        <h1>图片水印打码工具丨宋佳乐博客丨www.songjiale.com</h1>
        <article>安全地为你的图片加水印,无任何网络请求,特别适合各种敏感证件(身份证,驾照,护照等)。<a href="http://www.songjiale.com" target="_blank">更多精品</a></article>
        <label for="image">第一步:先选择一张本地图片</label>
        <p><input type="file" id="image" autocomplete="off"></p>

        
        <label for="text">第二步:输入需要打水印的文字</label>
        <p><input type="text" id="text" placeholder="请输入文字" autocomplete="off" maxlength="30">
        
        <label for="color">颜色</label>
        <input type="color" id="color" pattern="#[0-9A-Fa-f]{6}" autocomplete="off" value="#0000FF"><br>
        
        <label for="alpha">透明度</label>
        <input type="range" id="alpha" min="0" max="1" step="0.05" autocomplete="off" value="0.15"><br>
        
        <label for="space">间隔</label>
        <input type="range" id="space" min="1" max="8" step="0.2" autocomplete="off" value="4"><br>
        
        <label for="size">字号</label>
        <input type="range" id="size" min="0.5" max="3" step="0.05" autocomplete="off" value="1">
        </p>
        
        <label for="text">第三步:点击图片下载</label>
        <p id="graph"></p>
    </div>
    <script src="http://960416654.free3v.work/AI/tpsy/build/script.js"></script>

<div class="bdsharebuttonbox"><A class=bds_more href="#" tangram_guid="TANGRAM_2830" data-cmd="more"></A><A class=bds_qzone title=分享到QQ空间 href="#" data-cmd="qzone"></A><A class=bds_tsina title=分享到新浪微博 href="#" data-cmd="tsina"></A><A class=bds_tqq title=分享到腾讯微博 href="#" data-cmd="tqq"></A><A class=bds_renren title=分享到人人网 href="#" data-cmd="renren"></A><A class=bds_weixin title=分享到微信 href="#" data-cmd="weixin"></A></div>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"1","bdMiniList":["mshare","qzone","tsina","bdysc","weixin","tqq","tqf","tieba","bdhome","sqq","taobao","hi","mogujie","diandian","huaban","duitang","hx","fx","youdao","sdo","qingbiji","people","xinhua","mail","kanshou","isohu","yaolan","wealink","ty","iguba","fbook","twi","linkedin","copy","print"],"bdPic":"","bdStyle":"0","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
</ul>
</div>

</html>

文章来源:https://blog.csdn.net/songjiale1/article/details/135180190
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。