最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to convert PNG to GIF using javascript or other client-side tech? - Stack Overflow

programmeradmin7浏览0评论

I have a bination 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.

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.

I have a bination 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.

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.

Share Improve this question edited Aug 13, 2009 at 15:19 asked Aug 12, 2009 at 0:37 user154728user154728 2
  • 1 How do you create a PNG in the browser? Does this library maybe also offer JPEG output? And if you can create a PNG locally on IE, how e IE cannot then display it properly? And what is wrong with PNG in the first place? – Thilo Commented Aug 12, 2009 at 0:41
  • 2 I kind of want to take a peek at this client-side image creation script, but I'm scared. – deceze Commented Aug 12, 2009 at 1:04
Add a ment  | 

3 Answers 3

Reset to default 5

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

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.

Hmm. Looks like some options have e out over the last couple of years:

  • jsgif
  • mothereffinganimatedgif

  • png.js

It seems that you have a Flash object that outputs PNG. Can you add a JPEG or GIF output option to it?

As an alternative, it seems there is a JavaScript library that enables PNG support in IE. Not sure how well it works, though.

发布评论

评论列表(0)

  1. 暂无评论