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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:59:22+00:00 2026-05-13T14:59:22+00:00

I am using JAI and create a file with: PlanarImage img = JAI.create(fileload, myFilename);

  • 0

I am using JAI and create a file with:

PlanarImage img = JAI.create("fileload", myFilename);

I check before that line if the file exists. But how could I check if the file is a .bmp or a .tiff or an image file?

Does anyone know?

  • 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-13T14:59:23+00:00Added an answer on May 13, 2026 at 2:59 pm

    The Image Magick project has facilities to identify image and there’s a Java wrapper for Image Magick called JMagick which I think you may want to consider instead of reinventing the wheel:

    http://www.jmagick.org

    I’m using Image Magick all the time, including its “identify” feature from the command line and it never failed once to identify a picture.

    Back in the days where I absolutely needed that feature and JMagick didn’t exist yet I used to Runtime.exec() ImageMagick’s identify command from Java and it worked perfectly.

    Nowadays that JMagick exist this is probably not necessary anymore (but I haven’t tried JMagick yet).

    Note that it gives much more than just the format, for example:

    $  identify tmp3.jpg 
    tmp3.jpg JPEG 1680x1050 1680x1050+0+0 DirectClass 8-bit 293.582kb 
    
    $  identify tmp.png
    tmp.png PNG 1012x900 1012x900+0+0 DirectClass 8-bit 475.119kb
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using Entity Framework CodeFirst, how do I create a created datetime column that gets
I am using JAI to load in multipage TIFF images File file = workArea[0];
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C#, I need a class called User that has a username, password, active
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
We're using JAI ( https://jai-imageio.dev.java.net/ ) to scale and crop images in Java. We
Using mercurial, I've run into an odd problem where a line from one committer
I am having difficulty using the Java JAI (Java Advance Imaging) API to change
I'm trying to get a file with ant, using the get property. I'm running

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.