Bmp files - easy ?

maybe this is a begginner's question:
how do i load a bmp file into a BufferedImage ? i'm guessing it should be as easy as a jpeg (with the JPEGdecoder and all). or do i have to write my own format reader for this ???
thanks

You should use ImageIO.read.
Unfortunately, the j2se ships with readers for only gif, jpeg and png, but you can get more
service providers, including one for format bmp here.

Similar Messages

  • Creating pie chart diagram in java  and converting into BMP file

    hi all ,
    my req. is to create draw a pie chart diagram and store
    the picture in BMP. it is Possible. if so how ?
    cheers
    senthil

    Hi Senthil,
    This response is a bit late but I hope it can help in some way.  Your requirement (to create draw a pie chart diagram and store the picture in BMP) is possible and actually quite easy if you don't mind using two open source libraries.  In his previous response to this thread, Detlev mentioned JFreeChart for as a solution for charting however he also mentioned that it lacks support for BMP.  Although this is true, you can use the JFreeChart library (http://www.jfree.org/jfreechart/index.html) in conjunction with an imaging library to meet your requirement.  I have used JFreeChart on multiple projects and I highly recommend it.  For the imaging library you have many options, however the only one I have used is The Java Imaging Utilities (JIU - http://jiu.sourceforge.net/).  Using these two class libraries, you can generate your pie chart and save it to a BMP file with the following block of code:
         try
             JFreeChart chart = this.createChart();
             FileOutputStream streamOut = new FileOutputStream("your/files/path/BMPfile.bmp");
             BufferedImage image = chart.createBufferedImage(600, 300);
             if(image == null)
                  reportError("Chart Image is NULL!!!!!!!!");
                  return(false);
             RGB24Image rgbImage = ImageCreator.convertImageToRGB24Image(image);
             Codec codec = new BMPCodec();
             codec.setImage(rgbImage);
             codec.setOutputStream(streamOut);
             codec.process();
             codec.close();
             streamOut.flush();
             streamOut.close();
        }catch(IOException ioExcept)
             // throw or handle IOException...
             return(false);
        }catch(OperationFailedException opFailedExcept)
             // throw or handle OperationFailedException...
             return(false);
    The first line inside the catch block calls a helper method that should create the actual chart using the JFreeChart library.  Once you have your chart instance (all chart types are represented using the JFreeChart class), you can then retrieve a BufferedImage of the chart (JFreeChart.createBufferedImage(int width, int height);).  In our situation, the BufferedImage class will act as an "intermediate" class, for both libraries (the charting and imaging) can make sense of BufferedImages.  The rest of the code deals with storing the generated chart (the BufferedImage) as a BMP file to disk.  The RGB24Image, Codec, BMPCodec, CodecMode, and OperationFailedException classes are all part of the JIU library.  Also, note that the storage  source is not solely limited to a File on disk; the Codec.setOutputStream(OutputStream os) method will accept any subclass of OutputStream.  This implies that not only can you store to the actual App Server disk (where your app is running) but also to sources such as Knowledge Management (KM) resources or even directly to the clients browser (in the case of an iView). 
    Once again, sorry for the late response and let me know if you have any questions regarding the code above. 
    Regards,
    Michael Portner

  • Aperture won't import .bmp files

    I just set up Aperture (v. 1.5.4), and imported from iPhoto Library. All the .jpegs and .tiffs transferred over, but the .bmp files didn't. I tried to manually import them, but when I selected the folder they're in for import, the .bmp files didn't even show up as possible selections. They're there, but Aperture doesn't recognize them.
    Any way around this?

    "Compatible with all major still image formats
    JPEG, GIF, TIFF, PNG, PDF, PSD(2)"
    Note that BMP is not in that list, probably because it's a relatively rare image format these days.
    Your only way around this is to convert the files into another format. This is actually quite easy using Automator.
    1. Open Automator, click on Preview in the Library pane and drag a 'Change Type of Images' action into the main area.
    2. If you want to over-write the BMP files, don't add a copy action when Automator asks. I'd recommend leaving the copy action in and pointing it towards another folder.
    3. Pick a file format to convert to, such as JPEG. Note that there aren't any compression options.
    4. File>Save as Plug-in... and choose Finder from the drop-down menu. Give it a sensible name such as 'convert to JPEG' and this will now turn up in the Automator part of the contextual menus in the Finder.
    From now on whenever you want to convert a file to a JPEG, right-click on it and choose Automator>(whatever you named the action) and all selected files that you clicked on will be converted.
    Ian

  • Can Java support .bmp files?

    This is probably a dumb question but I'm just wondering if Java supports .bmp files. I know how big they are and that they're not 100% reliable at being transparent and that they are slow when it comes to scaling. I also found them slow when they are drawn transparently not to mention that they are also not reliable at being translucent either. But I do have a program that can convert bitmaps to GIFs, JPEGs, PNGs, PCX... well, just about every image format that there is out there but I do start creating my images as .bmp's because they're easy to edit. So does Java support them?

    I assume it does... If you're not sure, try it. But why the heck would you want to do that? BMP's are no easier to edit than PNG's, and PNG's are better than BMP's in every way. Using BMP's would be like shooting yourself in the foot. Also, when loading an image into memory, they don't work any differently than any other format. The only thing format affects is how the image works BEFORE it's loaded in. Once it's loaded, it's just another image. Different formats won't change the speed of working with them in Java.

  • How to save a CWGraph into a bitmap (.bmp) file in Visual C++?

    I plot (chart) data into a graph control on a MFC dialog in Visual C++ and I need to save the image into a bmp file. I found the ControlImage method, but did not find any way to use it in Visual C++.
    I would also like to retrieve the chart data (the point charted on the graph for each plot) and to use them to build data files. How to do it?

    Dealing with images in VC++ is far from easy. You would need to create the following objects: CBitmap, CArchive, CPictureHolder and a CDC.
    Then call the SelectObject function on the CDC and pass in the CBitmap object. Then you can put the image of the graph in the CPictureHolder with:
    ph.SetPictureDispatch((LPPICTUREDISP)m_CWGraph.Con​trolImage().m_lpDispatch);
    where ph is the CPictureHolder and m_CWGraph is the CWGraph.
    Then you can render the image to the bitmap CDC by calling the CPictureHolder::Render function. It will ask for the bounds of the picture in CRect form as well.
    Then you can call the CBitmap.Serialize function with the CArchive object which should be pointing to the appropriate BMP file. Don't you just love MFC?
    As for you second qu
    estion, you can't retrieve the data that has been plotted to the graph. We don't maintain the data that is sent in because it would be very inefficient memory usage since data is usually decimated for display. I would recommend that you just send your data to a global buffer at the same time as plotting.
    Best Regards,
    Chris Matthews
    Measurement Studio Support Manager

  • How to find a BMP file included with Applicatio​n in LabView?

    I have a VI that I would like to build into an application (.EXE).  The VI has a Picture indicator, whose source is a BMP on my local hard drive.  Using "Read BMP File.vi" and a Path constant, it's relatively easy to read the BMP and display it in the indicator.  I know how to include the file with the distribution (Build App or DLL -> Installer Settings -> Files), but how does one determine the location of the file after users install the EXE? I tried using just the filename of the picture in the path constant, hoping it would look in it's current directory, but I received an error.  With the full path in the path constant, everything works just fine.
    Thank you,
    ...jerry

    You can reconstruct the path. Use the "Current VI's path" to get the
    path of the caller VI. Then use the "Build path" and Strip path" to
    build the path to your file.
    Note that in an executable, the VIs path includes the executable, like
    the following:  C:\directory_name\my_exec.exe\main.vi
    The attached code (image) should do it (or at least give you a start).
    Regards;
    Enrique
    www.vartortech.com
    Attachments:
    path_to_file.gif ‏2 KB

  • Save an 16 bits grayscale image in a bmp file

    Hello,
    I need to save a bmp file using an I16 grayscale picture.
    I already did the following VI that saves the picture in bmp but the colors are not good : there is only blue levels.
    I think there is a problem with the type of data that feed "array to color image" or with the colorscale but i don't manage to find where.
    Hope you can help me.
    Tank you.
    Ben 

    Hi
    The arraytocolorimage expects U32 because expects a RGB color, try this instead of the "toU32"
    Rodrigo Cuenca
    www.cidesi.com

  • Issue in creating bmp file with cl_igs_chart_engine class

    Hi All,
    I want to populate dynamic graphic in a smartform.
    Im using cl_igs_chart_engine class to produce a GIF format of a chart.
    Then im trying to use class cl_igs_image_converter to convert that gif into a bmp format using INPUT = 'image/gif' and OUTPUT = 'image/x-ms-bmp'.
    but it returns with system failure exception  in
    call function 'PIGFARMDATA' .
    There is no error happening in case of converting any graphic format(bmp,tiff) to gif format but system failure exception occurs while trying to convert into bmp format.
    Appreciate your inputs.
    Cheers,
    Vikram

    Hi,
    I have taken a copy of program GRAPHICS_IGS_CE_TEST and made changes in it. In std program, file type in customizing XML is 'PNJ'. I changed it to 'BMP' as per your suggestion. However, in the
    call method l_igs_ce->execute
          exceptions
          others = 1.
    there is a call function for 'PIGFARMDATA'. Im getting exception error( sy-subrc = 2) for system failure.
    This program works fine if the file type in customizing XML is 'GIF' or 'PNG' but not for 'BMP' file types.
    Please advice.
    Cheers,
    Vikram

  • How to open a BMP file in a JLabel???

    Hi all,
    My problem is that I want to set a BMP file as icon of a JLabel, but the Class ImageIcon doesn't support BMP files.
    Thank you all.
    Marco Aur�lio
    from Brazil
    we'll win the FIFA World Cup!!

    The easiest way to do that is to get a graphics package that can convert a BMP file to a JPG file. Some versions of Microsoft Paint will do that, but you should be able to find another one if you need it.
    I hope Brazil wins, but if they don't it will be because the referees give it to Korea.

  • Error while uploading *.BMP file using SE78

    Hi
    I am trying to upload a BMAP file from presentation server onto the document server using SE78.
    I am facing an error saying
    "This is not a *.BMP file(they begin with <> "BM")"
    Message no. TD874
    I have the necessary company logo in this file and I want to put this in the sapscript.
    Is there some formatting that needs to be done to the bitmap file before importing in SE78.
    Please help!
    Thanks
    Bala

    hi
    Convert BMP from <b>Command prompt using ren command</b>
    then follow below process
    Go to transaction SE78.
    Follow the path given below (on the left windows box) :-
    SAPSCRIPT GRAPHICS --> STORED ON DOCUMENT SERVER --> GRAPHICS --> BMAP
    Enter the name of the graphics file on the right side and Go to the menu GRAPHIC --> IMPORT
    The program is RSTXLDMC, the logo needs to be save in .TIF format.
    Use transaction SE78 to inmport graphics to SAP.
    In the form painter, you can either include directly to the form using menu Edit->Graphic->Create or using the INCLUDE statement in a window.
    To use an INCLUDE stanment, goto into the woindow script editor and use menu Include->Graphic. The include can look like this for a bitmap:
    /: BITMAP MYLOGO OBJECT GRAPHICS ID BMAP TYPE BMON
    regards
    vinod

  • Read BMP File Requires Absolute Path

    I noticed something today regarding the Graphics Formats, Read JPG File, Read PNG File and Read BMP File vi's. It seems that when reading a JPG or PNG file, a relative path is OK, but when reading a BMP file, an absolute path is required. When the path only contains the filename, it returns:
        Error 1430
        "Open/Create/Replace File in Read BMP File Data.vi->Read BMP File.vi->ReadImageFileTest.vi"
    I tried a simple test that uses either the relative or absolute path, trying to read 3 different files in the same directory as the VI. Only the Read BMP File errors. Of course, the simple work around is to always use the full pathname to a file. Is this only on my system? Is this a known bug or feature or expected behavior?
    I'm using LabVIEW 8.2 on Windows XP.
    Thanks!
    B-)
    Message Edited by LabViewGuruWannabe on 11-05-2007 11:06 PM
    Attachments:
    ReadImageFileTest-FPgood.PNG ‏30 KB
    ReadImageFileTest-FPbad.PNG ‏26 KB
    ReadImageFileTest-BD1.PNG ‏48 KB

    Missed this on the first post:
    Message Edited by LabViewGuruWannabe on 11-05-2007 11:10 PM
    Attachments:
    ReadImageFileTest-BD.PNG ‏48 KB

  • Converting multiple bmp files to PDF using acrobat 7.0 from DOS prompt

    Hi,
    I have a requirement to convert multiple BMP files in a folder to one PDF.
    I can use multiple file conversion option in acrobat to combine and convert them to one PDF .. but I have 2000 such folder to conver to PDF.
    PDF should be name after the folder name.
    Is there a to automate this in acrobat.. or can we run this conversion from DOS prompt using commands.. so that I can create a bat file and have them converted. Pls let me know.
    Thanks
    Pugazh

    I have not tried BMP files, but do JPeg, GIF, TIFF, and PNG files regularly. I simply open Acrobat, then select the graphics files in explorer and drag & drop to Acrobat. I then organize the graphics if needed (using the pages tab) and save to a PDF.

  • Want to display a .bmp file in reports

    Hello there
    I am trying to display a .bmp file on reports which I think is simple.the main problem is that After making changes to report we transfer the report file to Unix and then generate the report in unix and print it and in that process the report stops printing.
    Thanks in advance.
    Jha

    make sure SOURCE FILENAME is valid in your LINK FILE pointing to the image.bmp
    Report compiles nicely even with wrong source filename, only when opening layout editor an error message will appear.

  • Hp6500A plus. When I scan a document to PDF it is produced as a BMP file.

    My scan settings are correct and have been saving correctly. All of a sudden the scanner starts producing a BMP file instead of a PDF file.  It doesnt matter what i do it will not work correctly.  I have switched off eveything , retstarted , checked for updates and it does not seem to correct.  Any help out there ?

    Hi @avjohn, 
    I see that you are experiencing issues saving PDF files, they are saving as a BMP file instead. I would like to help.
    Run all the Windows Updates and Adobe Updates.
    Download and run the Print and Scan Doctor. It will diagnose the issue and might automatically resolve it.
    Find and fix common printer problems using HP diagnostic tools for Windows?
    Try scanning again.
    If the issue persists, uninstall and reinstall the printer software.
    Uninstalling the Printer Software.
    HP Officejet 6500A Plus e-All-in-One Printer - E710n Drivers.
    Select your operating system, click next and click on the software to download and install.
    Try and scan again.
    Update the printer's firmware if you are still havinging issues. HP Officejet 6500A Plus e-All-in-One Printer - E710n Drivers. Select your operating system, click next, click the link for firmware.
    What were the results when you ran the Print and Scan Doctor? (did it print or scan, any error messages)
    What operating system are you using? How to Find the Windows Edition and Version on Your Computer.
    What application are you scanning with?
    How is the printer connected? (USB/Ethernet/Wireless)
    Please provide in detail the results if you are still having issues.
    Have a nice weekend!
    Thank You.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • How to call GOS(Generic Object service) attachment ( BMP file ) into SAP

    How to call GOS(Generic Object service) attachment ( BMP file ) into SAP script
    Example: MM02 Service object there attaching the bmp file the same file i need to call script based on the material number
    Please provide the procedure and  coding.
    Thanks in advance
    Raju

    Hi,
    The following link may be useful to u.
    help.sap.com/printdocu/.../BCSRVOBS.pdf

Maybe you are looking for

  • BPM - Alert Inbox - Detail List - Single Sign on

    Hi I have some issues with single signon and the detail list in the alert inbox. When I click the details list, it should open the list on the managed system, but for some reason it only takes me to the login screen of the managed system. I would lik

  • Unable to send files as attachments in email

    I have been trying to send a page document that I created and saved. I attached it as an attachment to an email and it comes back as below...I tried several times...any ideas or suggestions...the email will go as a test without an attachment but not

  • Lost icons on launch pad

    I have lost most of the icons on launch pad.  Anyone know how to restore them?

  • WAD vs VC

    What really differentiates Visual Composer from Web Application Designer? I know it depends on in-house skill set but when do we use VC and when do we use WAD? Thanks, Praveen.

  • Wesley chain : SOS adobe reader Error 109

    Hello, It's been a few days that I try to download the products adobe trial. Fact: impossible. Every time he says "Error downloading product (Error 109). Check your network or destination disk connection." I just formatted my hard drive, no change. I