Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is compression not supported for PNG?  RSS feed

 
Rohit Kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am simply creating ImageWriter as,

(ImageWriter) ImageIO.getImageWritersBySuffix("png").next();

And then create ImageWriterParam as,

writer.getDefaultWriteParam();

But it gives exception as "Compression not supported" on statement,

param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, PNGs can't be compressed like that; they are not like JPEGs. Given that the only subclasses of ImageWriteParam are BMPImageWriteParam and JPEGImageWriteParam, there's nothing much useful you can do with ImageWriteParam for PNGs.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!