简体   繁体   中英

Convert .png to .gif in java 1.5

I have a QR code generated in .png format. I want this file to be converted into .gif format for using it in a device. I was trying to use ImageIO class but gif is not supported in java 1.5 but in java 1.6 . Our production servers has java 1.5 and is there any way to convert a .png file to .gif using Java 1.5?

I'd rather use some command-line conversion tool (eg ImageMagick). But if in your environment that's not possible or practical, and if you want to do it in Java, you can try this backport .

Bear in mind that the conversion is not trivial if the PNG is true colour or has transparency, GIF is more limited.

Direct conversion from png to gif is not possible. so First try to convert png to jpg format and try to convert jpg to gif format.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM