在JavaScript中创建/修改图像 [英] Creating/modifying images in JavaScript

查看:102
本文介绍了在JavaScript中创建/修改图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在JavaScript(客户端)的每像素级 动态创建和修改图片?或者这是用基于服务器的语言完成的,比如PHP?

Is it possible to dynamically create and modify images on a per pixel level in JavaScript (on client side)? Or has this to be done with server based languaged, such as PHP?

我的用例如下:


  • 用户打开网页并加载本地存储的图像

  • 显示图像的预览

  • 用户可以使用一组滑块修改图像(像素级操作)

  • 最后他可以将图像下载到他的本地硬盘

  • The user opens webpage and loads locally stored image
  • A preview of the image is displayed
  • The user can modify the image with a set of sliders (pixel level operations)
  • In the end he can download the image to his local HDD

在网上搜索时我刚刚发现有关使用IE的过滤方法的帖子,但没有找到任何关于JavaScript的图像编辑功能。

When searching in the web I just found posts about using IE's filtering method, but didn't find anything about image editing functions in JavaScript.

推荐答案

这必须在服务器端完成。您可能要做的一件事是允许所有编辑进入客户端,然后最后将最终映像POST(通过AJAX)发送到服务器,以允许它将其作为正确的MIME类型返回给您,并且正确包装。

This has to be done on the server side. One thing you might look at doing is allowing all the editing to go on client side, and then in the end POST the final image (via AJAX) to the server to allow it to return it to you as the correct MIME type, and correctly packed.

这篇关于在JavaScript中创建/修改图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆