如何使用javascript或其他客户端技术将PNG转换为GIF? [英] How to convert PNG to GIF using javascript or other client-side tech?

查看:369
本文介绍了如何使用javascript或其他客户端技术将PNG转换为GIF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我结合了客户端技术,可以在浏览器中创建PNG数据.有没有一种方法可以将PNG数据转换为GIF以便在IE中显示,而无需将数据发送到服务器?想知道是否有一个现有的JavaScript库可以解析PNG数据并输出GIF甚至JPEG.我知道我可以将PNG数据发送到服务器,并且可以使用PHP/Python/或其他任何方式生成文件以在IE中显示,但是我的目标是将所有这些保留在客户端,即使图像的处理有些复杂慢.

I have a combination of client-side technologies creating PNG data in the browser. Is there a way to convert the PNG data to GIF for display in IE without sending the data to the server? Wondering if there is an existing JavaScript library that will parse the PNG data and output GIF, or even JPEG. I know that I can send the PNG data to a server and have PHP / Python / or whatever generate a file for display in IE, but I'm aiming to keep this all on the client side even if the processing of the image is somewhat slow.

更新: 没有明显的现有JavaScript库可以执行此操作,因此我将使用Flash将图像数据转换为IE的GIF输出,并继续将PNG用于所有其他浏览器.

UPDATE: No obvious existing JavaScript libraries to do this, so I'll use Flash to convert image data to GIF output for IE and continue to use PNG for all other browsers.

推荐答案

有可能吗?我想. JavaScript是图灵完备的,我想一个人也许可以通过输出一种<img src="data: ..." />格式来解决浏览器的限制.

Is it possible? I suppose. JavaScript is Turing-complete, and I suppose one might be able to get around browser restrictions by outputting an <img src="data: ..." /> sort of format.

这是可行的还是一个好主意?一定不行.这样做就像需要一些混凝土并开发出Moon火箭来收集月球尘埃来制造它,而不是在Home Depot上购买一些.

Is it feasible or a good idea? Hell no. Doing this would be like needing some concrete and developing a Moon rocket to harvest lunar dust to make it instead of buying some at Home Depot.

这篇关于如何使用javascript或其他客户端技术将PNG转换为GIF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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