File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Image formats allowed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Image formats allowed" Watch "Image formats allowed" New topic
Author

Image formats allowed

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Hi, I have an application which lets you load images from your desktop.
Using the code...

Where path would be something like "res/images/cars/ferrari.jpg"
Also the res folder is in the same directory as the project.

I know I can use jpg(jpeg),png,gif.
Are there any others? I couldn't seem to get bmp to work.

Thanks
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
On the page How to Use Icons the supported formats are listed in the first paragraph. It is repeated at the bottom under the header The Image Icon API, first section Setting, Getting, and Painting the Image Icon's Image, top box on the right.
The newer ImageIO class offers more flexibility in formats. Support for the bmp and wbmp formats was introduced in j2se 1.5 and gif support came in j2se 1.6
For an introduction see Loading and Saving Images With the Image I/O Library. It shows you how to determine which formats are supported in your version.
 
Don't get me started about those stupid light bulbs.
 
subject: Image formats allowed
 
Similar Threads
Serving static assets from a servlet
NullPointerException - Can't figure this out
How to write dynamic images to web server?
Image Display problem
table using lwuit in j2me