在线编辑图片(转)

一个免费的图片编辑SDK,可用于web,ios,android平台。本文主要介绍web端使用方法。

 

1 效果图

点击 “Edit Photo” 按钮, 查看效果图

 

image

 

 

2 实现

复制下面代码,保存为html文件

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>图片编辑</title>
  
   <script src="https://code.jquery.com/jquery-1.7.2.js"></script>
    <script src="https://dme0ih8comzn4.cloudfront.net/js/feather.js"></script>
    <script type='text/javascript'>        
        //在线编辑图片功能,第三方插件,完全免费
        var featherEditor = new Aviary.Feather({
            apiKey: '121285904@qq.com',//apikey可以免费申请,https://creativesdk.adobe.com/docs/web/#/index.html
            apiVersion: 3,
            theme: 'dark', // Check out our new 'light' and 'dark' themes!
            tools: 'all',//这里设置为all,可以显示所有的工具
            initTool: 'text',//默认展开的工具
            language: 'zh_HANS',//简体中文
            appendTo: '',          
            onSave: function (imageID, newURL) {
                
                //alert(newURL);
                $.ajax({
                    url: "ashx/CarInfo.ashx?type=DownloadCarPhoto&imgUrl=" + newURL + "&rand=" + Math.random(),
                    success: function (url) {
                        alert('保存成功');
                        var img = document.getElementById(imageID);
                        img.src = url;
                    },
                    error: function () {
                        alert('error')
                    }
                });
                
            },
            onError: function (errorObj) {
                alert(errorObj.message);
            }
        });
        function launchEditor(id, src) {
            featherEditor.launch({
                image: id,
                url: src
            });
            return false;
        }
</script>
</head>
<body>
    <form id="form1" runat="server">
   <div id='injection_site'></div>
<img id='image1' src='https://img.alicdn.com/imgextra/i2/62935302/TB2hBzSeXXXXXbMXXXXXXXXXXXX_!!62935302.jpg'/>
 
<!-- Add an edit button, passing the HTML id of the image and the public URL of the image -->
<p><input type='image' src='' value='Edit photo' οnclick="return launchEditor('image1', 'https://img.alicdn.com/imgextra/i2/62935302/TB2hBzSeXXXXXbMXXXXXXXXXXXX_!!62935302.jpg');" /></p>
 
    </form>
</body>
</html>

 

作者:疯吻IT 出处:http://fengwenit.cnblogs.com

3 参数介绍

apiKey

必须,apikey可以免费申请,https://creativesdk.adobe.com/docs/web/#/index.html

所有的工具

            tools: 'text,resize',//这里设置为all,可以显示所有的工具;如果只想显示部份工具,可以用逗号分隔

所有工具如下:

  • enhance: Autocorrect your photo with one of five basic enhancements.

  • effects: Choose from a variety of effects and filters for your photo.

  • frames: Choose from a variety of frames to apply around your photo.

  • overlays: Choose from a variety of overlays to apply over your photo.

  • stickers: Choose from a variety of stickers you can resize and place on your photo.

  • orientation: Rotate and flip your photo in one tool.

  • crop: Crop a portion of your photo. Add presets via API. Fixed-pixel cropPresets perform a resize when applied.

  • resize: Resize the image using width and height number fields.

  • lighting: Adjust the lighting in your photo with this collection of adjustment toools.

  • color: Adjust the color in your photo with this collection of adjustment toools.

  • sharpness: Blur or sharpen the overall image in one tool.

  • focus: Adds a selective linear or radial focus to your photo.

  • vignette: Adds an adjustable vignette to your photo.

  • blemish: Remove skin blemishes with a brush.

  • whiten: Whiten teeth with a brush.

  • redeye: Remove redeye from your photo with a brush.

  • draw: Add doodle overlays with a brush.

  • colorsplash: Use a smart brush to colorize parts of your photo which becomes grayscale otherwise.

  • text: Add custom, resizable text.

  • meme: Turn your photo into a meme with this tool that adds text to the top and bottom of your photo.

 

默认展开的工具


            initTool: 'text',//默认展开的工具

 

语言

            language: 'zh_HANS',//简体中文

默认en 为英语

  

保存

            onSave: function (imageID, newURL) {

                //alert(newURL);

                $.ajax({

                    url: "ashx/CarInfo.ashx?type=DownloadCarPhoto&imgUrl=" + newURL + "&rand=" + Math.random(),

                    success: function (url) {

                        alert('保存成功');

                        var img = document.getElementById(imageID);

                        img.src = url;

                    },

                    error: function () {

                        alert('error')

                    }

                });

            },

     

4 官方文档

https://creativesdk.adobe.com/docs/web/#/index.html

 

在线系列

http://www.cnblogs.com/fengwenit/p/4738260.html

 

Pixie Image Editor 在线图片编辑器 中文版 功能 集成 - 轻松将pixie集成到任何现有项目或应用程序中。 可扩展 - Pixie接口和API可以使用新功能进行扩展。 移动 - Pixie拥有完整的移动支持,并可自动调整其界面以适应任何设备的大小。 可自定义的UI - 通过显示,隐藏或添加新菜单项,更改工具栏位置或使用不同的主题来自定义UI。 可翻译 - Pixie的界面可通过配置完全翻译。 水印 - 保存的照片可以使用指定的文本轻松加水印。 模式 - 在叠加(模态),内联或全屏模式之间进行选择。 工具API - 通过API使用所有精灵工具(调整大小,裁剪,框架等),而无需打开精灵界面。 可自定义的工具 - 所有工具都可完全自定义,您可以删除或修改和添加自定义贴纸,形状,字体,框架等。 状态 - 以json格式保存当前编辑器状态,允许使用预构建模板等功能。 照片处理 - 通过界面或API调整大小,裁剪,换等。 滤镜 - Pixie配有许多内置滤镜,如灰度,模糊,黑白,复古等。可以通过API添加更多过滤器.. 框架 - 为任何大小的照片添加内置响应帧或添加自己的帧。 裁剪 - 将照片裁剪为指定宽高比之一,或让用户通过UI选择自定义裁剪区域。 绘图 - 功能强大的免费绘图工具支持鼠标和触摸,具有多种画笔类型,颜色等。 文本 - 完全支持向图像添加文本。可以使用数百种谷歌字体或仅使用自定义添加的字体。 形状 - 只需指定svg图像路径,即可轻松添加自定义形状。 贴纸 - 可以添加或删除自定义贴纸。任何类型的图像都可以用作贴纸。 角落 - 只需单击一下或API调用即可对图像角进行四舍五入。 空画布 - Pixie不必编辑现有照片,也可以从头开始轻松创建自定义图像。 历史记录 - 所有编辑器操作都是非破坏性的,可以通过历史记录工具轻松撤消和重做。 对象 - 所有对象(如贴纸,形状和文本)都在自己的图层上,可以通过更改颜色,添加阴影,背景等来轻松移动,调整大小,删除和修改。 图案和渐变 - 所有对象都可以使用许多内置或自定义图案和渐变填充。 保存 - 修改后的图像可以通过API或接口轻松保存在本地设备或服务器上。 缩放和平移 - 可以使用鼠标,鼠标滚轮或移动设备上的触摸和捏合手势来缩放和平移画布。 HTML5 - Pixie使用原生HTML5,这意味着它可以在每个设备上运行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值