File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes .bmp file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark ".bmp file" Watch ".bmp file" New topic

.bmp file

Soumik Basu
Ranch Hand

Joined: Oct 01, 2007
Posts: 40
hi all,
I have written a JSP/Servlet application in windows environment. This application has to show .bmp images.
I wanted to know -is it possible for me to run this application on Linux platform and will .bmp image open properly in JSP/Servlet application running on Linux platform.
I am new to LInux,So please be generous to help me .
Thanks in advance.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
BMP is not one of the image formats supported by all browsers; use PNG instead. If you can't (or don't want to) convert the images outside of the web app, or make copies of them in PNG, have a look at the javax.imageio.ImageIO class. Its read and write methods make reading an image file into memory, and then saving it to a stream (e.g. a servlet's OutputStream), very easy.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15092

Indeed, .BMP is a Microsoft format, but it is well-documented so opening a .BMP file on Linux is no problem.

The major webbrowsers including Firefox will have no problem displaying a .BMP file.

Note that, as far as I know, Microsoft's Internet Explorer unfortunately still does not fully support PNG.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
You're right - I just verified that both Firefox and Safari support BMP. Not sure about Opera, though.

I think IE's problems with PNGs are in the area of transparency and alpha channels, which are features not supported by BMP anyway.
[ November 29, 2007: Message edited by: Ulf Dittmer ]
I agree. Here's the link:
subject: .bmp file
It's not a secret anymore!