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

  • SEARCH
  • Home
  • 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 7960715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:50:00+00:00 2026-06-04T04:50:00+00:00

Let me start off with I have no code and I have no idea

  • 0

Let me start off with I have no code and I have no idea what I am suppose to do. Apparently the information is stored in the meta data of the .png file. I figure this should not be so hard to do, but it is turning out to be a challenge.

The only thing that looks somewhat useful is the following post here at stack overflow.

How to set DPI information in an image?

However I have tried to use the code that was provided and the websites that were provided to do such things and have achieved nothing.

When I try to use the Iterator, like below, I get an error with both the iw.hasNext() and the iw.next().

Errors are:

  • The method hasNext() is undefined for the type HTMLDocument.Iterator
  • Type mismatch: cannot convert from void to ImageWriter

    for (Iterator iw = (Iterator) ImageIO.getImageWritersByFormatName(formatName); iw.hasNext;) {
    ImageWriter writer = iw.next();

My question is, where do I start and what do I need to be looking for? Are there any examples that you know of or have you done this yourself?


One a side note my questions about the “How to set DPI information in an image?” post are this…

  1. Why is it then when I use the Iterator like he does, I get errors?
  2. What is “INCH_2_CM” suppose to mean / be?

The way I changed his code is below…


    for (Iterator iw = (Iterator) ImageIO.getImageWritersByFormatName(formatName); iw.hasNext();) {
       ImageWriter writer = iw.next();
       ImageWriteParam writeParam = writer.getDefaultWriteParam();
       ImageTypeSpecifier typeSpecifier = ImageTypeSpecifier.createFromBufferedImageType(BufferedImage.TYPE_INT_RGB);
       IIOMetadata metadata = writer.getDefaultImageMetadata(typeSpecifier, writeParam);
       if (metadata.isReadOnly() || !metadata.isStandardMetadataFormatSupported()) {
          continue;
       }

       setDPI(metadata);

       final ImageOutputStream stream = ImageIO.createImageOutputStream(output);
       try {
          writer.setOutput(stream);
          writer.write(metadata, new IIOImage(gridImage, null, metadata), writeParam);
       } finally {
          stream.close();
       }
       break;
    }
  • 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. Editorial Team
    Editorial Team
    2026-06-04T04:50:02+00:00Added an answer on June 4, 2026 at 4:50 am

    Your code is getting confused between the classes javax.swing.text.html.HTMLDocument.Iterator and java.util.Iterator. His code uses the latter, but your code seems to be using the former. Use fully qualified types, or figure out how to modify your imports.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me start off with some code. When the application loads, it calls the
Let me start off by describing my situation. I have a main view that
Okay let me start off by saying I have been looking around a lot
My question is best illustrated with a code sample, so let's just start off
Ok, let me start off by saying that I'm don't have the slightest clue
Let me start off by saying I don't want to print only the duplicate
First off, let me start by saying that I am totally new to working
Let’s start with this statement: We have published couple of free applications on the
Let me start off with I'm mostly new to writing Java, so I would
To start off, let me clear the air by saying we are aware of

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.