Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 79313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:07:34+00:00 2026-05-10T21:07:34+00:00

I am having issues converting a png to tiff. The conversion goes fine, but

  • 0

I am having issues converting a png to tiff. The conversion goes fine, but the image is huge. I think the issue is that I am not doing the compression correctly? Anyone have any suggestions??

Here is the code sample

public static void test() throws IOException {      // String fileName = '4958813_1';     String fileName = '4848970_1';     String inFileType = '.PNG';     String outFileType = '.TIFF';      ImageIO.scanForPlugins();      File fInputFile = new File('I:/HPF/UU/' + fileName + inFileType);     InputStream fis = new BufferedInputStream(new FileInputStream(             fInputFile));     PNGImageReaderSpi spi = new PNGImageReaderSpi();     ImageReader reader = spi.createReaderInstance();      ImageInputStream iis = ImageIO.createImageInputStream(fis);     reader.setInput(iis, true);     BufferedImage bi = reader.read(0);      TIFFImageWriterSpi tiffspi = new TIFFImageWriterSpi();     ImageWriter writer = tiffspi.createWriterInstance();     //Iterator<ImageWriter> iter =  ImageIO.getImageWritersByFormatName('TIFF');     //ImageWriter writer = iter.next();      ImageWriteParam param = writer.getDefaultWriteParam();     param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);      param.setCompressionType('LZW');     param.setCompressionQuality(0.5f);     File fOutputFile = new File('I:\\HPF\\UU\\' + fileName + outFileType);     ImageOutputStream ios = ImageIO.createImageOutputStream(fOutputFile);     writer.setOutput(ios);     writer.write(bi);  } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:07:35+00:00Added an answer on May 10, 2026 at 9:07 pm

    Writer.getDefaultWriteParam() only creates an ImageWriteParam object, it doesn’t link it back to anything else.

    I don’t see any mechanism in your code for your modified param object to be subsequently used in the ImageWriter.

    I believe that instead of:

    writer.write(bi); 

    you need to use:

    writer.write(null, new IIOImage(bi, null, null), param); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to C++ and am having an issue converting a signed char
I have a website that seems to be having some issues with either the
I'm having issues connecting to an ASP.Net web service using PHP. The web service
I am attempting to create a EJB3.0 container-managed persistence bean and am having issues
I'm having an issue when trying to run my project each time it builds.
I have an application that lets users record video from their webcams. The users
I have the following custom function for converting hours into unit of time: def
I am migrating a MySQL 5.1 database in Amazon's EC2, and I am having
I'm currently adding an out of office like system to a website, where users
I have tried googling and read through https://help.github.com/en/articles/connecting-to-github-with-ssh and various, various guides. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.