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 6367731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:35:11+00:00 2026-05-25T00:35:11+00:00

Working with images in Java for the first time and am getting some bizarro

  • 0

Working with images in Java for the first time and am getting some bizarro exceptions that aren’t documented very well. Here’s the line of code that is failing:

BufferedImage imgSelected = ImageIO.read(new File("/abs/url/to/file/image.jpg"));

This line is throwing an IIOException with Unsupported image type as the exception message. I have checked and re-checked that it is in fact this line throwing the exception, that the File object is valid, that the URL is valid, and that the image.jpg is in fact a valid JPG that loads perfectly fine in other image viewers.

What could I do to get more information about the nature of this exception? Is this the traditional way for loading images in Java 7, or is this an old/deprecating method? There’s just not a lot of info out there about these “Unsupported image type” exceptions, and surely, ImageIO supported JPGs!

Thanks for any help!

  • 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-05-25T00:35:12+00:00Added an answer on May 25, 2026 at 12:35 am

    Try to check the encoding of the JPEG. ImageIO can’t read CMYK-encoded jpeg images for example.
    AFAIK, ImageIO hasn’t been updated for years, so you’d like to try and use the official alternative/extension: JAI ImageIO.

    Unforutnately, JAI ImageIO needs some native libraries installed into the JRE, which might be unwanted.
    We do the following:

    • use Apache Sanselan to detect, whether it’s a JPEG
    • since Sanselan can’t read and write JPEG, use the plain old AWT JPEGCodec: JPEGCodec.createJPEGDecoder(...)
    • to convert CMYK to RGB, we then get the raster of the read BufferedImage and manually convert it (you could use ICC profiles, but the manual conversion fits our needs)

    Here’s a question of mine that resulted of the fact that ImageIO doesn’t support all types of JPEG images, and I there stated a little more of my findings of why you get that message: Pure Java alternative to JAI ImageIO for detecting CMYK images

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

Sidebar

Related Questions

I'm working with java images for the first time and having a problem viewing
I'm working on a Java project that involves retrieving a large amount of images
I'm working on some code to colorize an image in Java. Basically what I'd
I'm working on a home project that involves comparing images to a database of
I am working on an iPhone Application that stores images in the Applications 'Document'
Right now I'm working with an ASP.NET website that automatically generates images and stores
I'm working on a Java program that needs to send an image (preferably in
Working with a latex document with eps images as in the example below... \documentclass[11pt]{paper}
I am working on a program which manipulates images of different sizes. Many of
I am working on a web-application in which dynamically-created images are used to display

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.