Java Code to Convert GIF to BMP

Hi,
Could anyone please tell me the Java Code to convert the GIF image to BMP image.
Thanks,
Rathish

Here is a sample code for reading an Excel file. It uses JExcel API:
package com.quicklyjava;
import jxl.*;
import jxl.read.biff.BiffException;
import java.io.File;
import java.io.IOException;
public class JavaExcelRead {
* @param args
public static void main(String[] args) {
try {
//Create a workbook object from the file at specified location.
//Change the path of the file as per the location on your computer.
Workbook wrk1 = Workbook.getWorkbook(new File("C:/test.xls"));
//Obtain the reference to the first sheet in the workbook
Sheet sheet1 = wrk1.getSheet(0);
//Obtain reference to the Cell using getCell(int col, int row) method of sheet
Cell colArow1 = sheet1.getCell(0, 0);
Cell colBrow1 = sheet1.getCell(1, 0);
Cell colArow2 = sheet1.getCell(0, 1);
//Read the contents of the Cell using getContents() method, which will return
//it as a String
String str_colArow1 = colArow1.getContents();
String str_colBrow1 = colBrow1.getContents();
String str_colArow2 = colArow2.getContents();
//Display the cell contents
System.out.println("Contents of cell Col A Row 1: \""+str_colArow1 + "\"");
System.out.println("Contents of cell Col B Row 1: \""+str_colBrow1 + "\"");
System.out.println("Contents of cell Col A Row 2: \""+str_colArow2 + "\"");
} catch (BiffException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
You can further process this to convert the data extracted into XML. Hope this helps!

Similar Messages

  • Java code for converting EDI file to XML file

    Dear friends,
                     Can you please help me in getting the java code for converting to EDI file to XML file.

    Hi,
    You can convert the EDI file to XML in any of the ways
    1) Using third party seeburger adapters
    2) Conversion agent
    3) Stylus studio.
    I think using java code it will be very difficult.
    Thnx
    Chirag

  • Java code to convert - Hex to Dec

    I'ld like to convert an Integer or a String from hexadecimal format to a decimal format;
    For example: 30 give 0; 50 give P and so on.
    Can any one help me sending to me a java code that do it please?
    Thanx a lot

    This doesn't convert hex to decimal, but it does convert hex to the character representation, which is what it sounds like you want. At any rate, given "30" it will print "0" and given "50" it will print "P". Also, given "P" it will print "is invalid".
            try
                int in = Integer.parseInt(s, 16);
                Character ch = new Character((char)in); // should validate range here
                System.out.println("In: " + s + ", out: " + ch);
            catch (NumberFormatException e)
                System.out.println("In: " + s + " is invalid.");
            }

  • Java code to convert XML file to ISO XML format

    Hi Experts,
    I need to convert an XML file to ISO Xml format using Java code.I dont have any idea about the ISO XML format.I searched but what i am getting is ISO is an encoding in XML.
    It will be very helpful if any one can give me a sample ISO XML file, and any way around to carry out the required conversion.
    Thanks .
    Anika

    Hi,
    For ISO encoding you need the XML file to be converted with below providing the encoding paramter as ISO. for e.g.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    instead of
    <?xml version="1.0" encoding="UTF-8"?>
    this can be possible with using XML encoders.
    Refer XML encoding--> http://www.w3schools.com/XML/xml_encoding.asp
    Refer Java Code with uasage of XMLEncoder
    http://java.sun.com/j2se/1.4.2/docs/api/java/beans/XMLEncoder.html
    Thanks
    Swarup

  • JAVA code to Convert Excel file To XML file

    Hi,
    I am new to java ,Any one please share me the code to convert Excel file in to xml file.
    Thanks in advance.

    Here is a sample code for reading an Excel file. It uses JExcel API:
    package com.quicklyjava;
    import jxl.*;
    import jxl.read.biff.BiffException;
    import java.io.File;
    import java.io.IOException;
    public class JavaExcelRead {
    * @param args
    public static void main(String[] args) {
    try {
    //Create a workbook object from the file at specified location.
    //Change the path of the file as per the location on your computer.
    Workbook wrk1 = Workbook.getWorkbook(new File("C:/test.xls"));
    //Obtain the reference to the first sheet in the workbook
    Sheet sheet1 = wrk1.getSheet(0);
    //Obtain reference to the Cell using getCell(int col, int row) method of sheet
    Cell colArow1 = sheet1.getCell(0, 0);
    Cell colBrow1 = sheet1.getCell(1, 0);
    Cell colArow2 = sheet1.getCell(0, 1);
    //Read the contents of the Cell using getContents() method, which will return
    //it as a String
    String str_colArow1 = colArow1.getContents();
    String str_colBrow1 = colBrow1.getContents();
    String str_colArow2 = colArow2.getContents();
    //Display the cell contents
    System.out.println("Contents of cell Col A Row 1: \""+str_colArow1 + "\"");
    System.out.println("Contents of cell Col B Row 1: \""+str_colBrow1 + "\"");
    System.out.println("Contents of cell Col A Row 2: \""+str_colArow2 + "\"");
    } catch (BiffException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    You can further process this to convert the data extracted into XML. Hope this helps!

  • To Convert GIF to BMP

    Hello,
    Plz can anyone tell me how do i programatically convert GIF image to BITMAP image.
    Thanks,
    Rathish
    Moderator message: not related to ABAP development.
    locked by: Thomas Zloch on Aug 12, 2010 12:04 AM

    Hi,
    Firstly why you want to convert the GIF to BITMAP pragramatically. If the requirement is to display the Image in the Forms then just convert the GIF image to BITMAP using Paint (Open the image in Paint and then save as BITMAP) and then upload BITMAP image  in SAP and then use the same in the forms.
    Regards,
    Shakeel.

  • Java Code to Convert a file (license) in Excel's CVS Format

    Hi!
    Can anyone suggest me the Code to convert a File in a very specific format that we can read in Excel liek CVS Format of Excel?
    Thanks
    Bob

    What is the format of the License file? Is there a format like .licence format or something like that. Excel recognizes CSV's. So if you can expand the format of the incoming licence file, I may be able to help you.

  • 3DES - Php crypto codes 2 Java codes convertion problem

    I give all php and java codes I convert one by one but I didnt get same result where is my mistake and what shall I do. Thanks for all.
    Php Code
    $key = "db9ca45ee012dcabaff193ca";
    $input = sha1("MehmetKaraman");
    $td = mcrypt_module_open('tripledes', '', 'ecb', '');
    $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
    mcrypt_generic_init($td, $key, $iv);
    $encrypted_data = mcrypt_generic($td, $input);
    mcrypt_generic_deinit($td);
    mcrypt_module_close($td);
    echo sha1(bin2hex($encrypted_data));
    Output : d7eaa53ab43683a1323cfae877a24efb4a918411
    Java Code :
    String message= “MehmetKaraman”;
    byte[] input = MessageDigest.getInstance("SHA1").digest(message.getBytes("utf-8"));
         final Cipher cipher = Cipher.getInstance("DESede/ECB/NoPadding");
         final SecretKey key = new SecretKeySpec("db9ca45ee012dcabaff193ca".getBytes("utf-8"), "DESede");
    cipher.init(Cipher.ENCRYPT_MODE, key );
    if( input.length % 8 != 0){
         byte [] in2 = new byte[input.length+ 8- input.length%8];
         for(int i = 0;i<input.length;i++){
         in2=input[i];
         input = in2;
         final byte[] encrypted_data = cipher.doFinal(input);
         System.out.println(bin2hex(MessageDigest.getInstance("SHA1").digest(bin2hex(encrypted_data).getBytes())));
    Output : 626b61642ec4ba8f7467933832619d492a6fdde1

    Either you need$input = sha1("MehmetKaraman", true);or in your Java you need to hex encode your sha1 digest before encrypting. When I do either of these and emulate your Java bin2hex() method I get a match.
    I don't understand why people seem unable to do simple debugging. If you had read the PHP documentation for the sha1() function and had printed out the results at each stage it would have been obvious.
    P.S. The zero padding implemented by your codeif( input.length % 8 != 0){
    byte [] in2 = new byte[input.length+ 8- input.length%8];
    for(int i = 0;i<input.length;i++){
    in2=input[i];
    input = in2;
    }can be replaced by 1 line using one of the methods in class java.util.Arrays.
    Edited by: sabre150 on Sep 15, 2010 3:10 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Looking for Java Image Format converter

    hi,
    I am looking for an open-source site or so, which has Java code on converting different Image types eg. gif/jpeg etc. to PNG. I am building an application which needs to display images. It would be great to have a tool which takes the image and converts it to the PNG format.
    Can anyone help me out?
    cheers :)
    cleoppatra

    hi cleo. there is no tool you can patch into your source. there are two posibilities that i know of.
    1. take a look at the algorith for gif and jepg and chang it to png.
    2. send the link to a server, which you have to program, as a servlet, which will get the html page just as the midp would do, have a normal converter jpg -> png or gif -> png, see if what type of image it is, choose the right converter and convert the pic. format the text the way you want and then send it to the mobile phone. this will make most of the work be much faster since the mobile phone is very slow, and wont be very evectif on converting stuff.
    think about it.
    jeliel

  • Convert JPG to BMP using XI

    Hi
    I would like to transfer the Image file from one Legacy System to SAP R/3 server which then ABAPers can utilize using TCode: <b>SE78</b>.
    But here are the constraints -->
    *) The Legacy System is providing the Image file in JPEG format <u>Only</u>.
    *) SAP R/3 TCode : SE78, can <u>only</u> take the files in BMP format.
    *) Even if you simply change the extension of JPEG file to BMP, then SAP R/3 is <u>not accepting</u> that file which suggest it needs typical BMP file only.
    I referred this thread also
    Error while uploading *.BMP file using SE78
    In this thread user actually resolves his problem after using a tool which explicitly converted a JPG to BMP but they are not using XI.
    Now is their any way with which JPG can be converted to BMP. I found couple of tools but they require the file first ( using browse option ) & then they will convert it, mean you can't call them using XI & provide that file as an argument.
    I just need to know what you all think, is it possible to convert the JPG to BMP using XI or not. Also are you aware of any Java/.NET which can actually take the Image file ( JPG format ) & convert it & provide it back.
    Regards
    - Lalit -

    Hi Lalit,
      I've made a quick search and in my opinion the better thing you can do, is to create a Java routine to convert JPG to BMP.
    you can use JAI (Java Advanced imaging) to read input stream (JPG format), and convert into a BMP format.
    <a href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide.pdf">This PDF</a> contains the JAI documentation and some examples.
    I hope it will help.
    Best regards
    Manuel

  • Creating XML from java Code

    Hello @ll,
    I need a java code to convert XML file ,which has one node to again a XML file with multiple nodes,depends on the content of source XML File....
    The source structure is something like this:
    <Name>abcd;xyzw;prs</Name>
    and the target structure is something like:
    <FirstNAme>abcd</FirstNAme>
    <MidNAme>xyzw</MidName>
    <LastName>prs</LastName>
    the length of the data is not fixed. and ";" is used as a seperator.
    I have hundred such nodes on the target side.
    How do i acheive this
    Thanks in Advance.
    With Regards,
    BVS

    DEVELOPEMENT-THRILL wrote:
    hi ,
    what i think he can convert the xml to java object by using xstream then he can do his desired work in java and again he can convert it to xml by using xstream again.
    RegardsAn enormous waste of time, though. His "desired" work doesn't need any Java at all, beyond maybe kicking off the transform. Seriously, you've given some poor advice - as we all do from time to time - just accept it rather than try to justify it in retrospect. One of the biggest mistakes you can make as a developer is to use the same tool for everything simply because you already know how to. XSLT and XPath are enormously useful tools to have kicking about, and pretty trivial to learn as well. What could take dozens of lines of Java to achieve could take a single XPath query. Which would you prefer?

  • Convert java code into UML

    hello,
    anybody knows a software convert java code into UML? Classes Diagram.
    for example JBuilder do that.
    // i use Netbeans.

    its not a speed issue although sometimes it can be painfully slow (but now slower that sun one). I constantly found myself getting into infinite error message loops (e.g. "incorrect input"... click ok... "incorrect input"... errr click ok.... "incorrec..." etc etc), and also it (relatively) regularly falls over. I tried to export diagrams as GIFs, and when I imported them into Word they looked ok, but when I printed them they printed negative!! I used about 100g of toner before I realised, and had to go thru all diagrams changing them to JPGs. Plus, I think the interface for 6 is a lot less intuitive than 4.2, and it's trying to be too feature rich. Personally I would never use it as a code editor as it's too big and lumbering. For me, it's a diagramming tool, but it doesn't even put pretty pictures as nodes on deployment diagrams!! I want pictures of workstations, PDAs and databases!! Only kidding...

  • Why java only can display GIF file not jpeg and BMP ??

    Did anyone know why java only can display GIF file not in jpeg and BMP ?? This is because the quality of GIS is not as good as Jpeg and BMP
    any code to load the display process ??
    thx guys !!!

    you can do jpegs but im not sure about bmps.
    The only thing ive noticed is that java cant support transparent jpegs, only transparent gifs
    Jim

  • Convert Below Java code equivalent to c# windows store app.

    Hi
    please help me " To convert Below Java code equivalent to c# windows store app."
    private String SecretKey = "enctsbqrm6hxyjfa";
        public byte[] encrypt(String text) throws Exception
            if(text == null || text.length() == 0)
                throw new Exception("Empty string");
            // convert key to bytes
            byte[] keyBytes = SecretKey.getBytes("UTF-8");
            // Use the first 16 bytes (or even less if key is shorter)
            byte[] keyBytes16 = new byte[16];
            System.arraycopy(keyBytes, 0, keyBytes16, 0, Math.min(keyBytes.length, 16));
            // convert plain text to bytes
            byte[] plainBytes = text.getBytes("UTF-8");
            // setup cipher
            SecretKeySpec skeySpec = new SecretKeySpec(keyBytes16, "AES");
            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding");
            //byte[] iv = new byte[16]; // initialization vector with all 0
            cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
            // encrypt
            byte[] encrypted = cipher.doFinal(plainBytes);
            return encrypted;
      Thanks            
      Nitin

    Hello Nitin,
    Your current requirement is beyond the scope of our support for this fourm which is used to Discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection.
    If you want to know how to encrypt/decrypt in windows store app, I suggest that you could post a it to:
    https://social.msdn.microsoft.com/Forums/windowsapps/en-US/home?forum=winappswithcsharp
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Convert SQL statements to JAVA Code ?

    Using SQL queries Can I convert SQL statements to JAVA Code ?
    Edited by: user11238895 on Jun 7, 2009 10:54 PM
    Edited by: user11238895 on Jun 7, 2009 11:12 PM

    Me very new to Oracle.
    can we convert SQL Queries to JAVA Code using simple built in SQL queries ?
    Which SWISS SQL Tool does [Converting SQL Queries to JAVA Code]

Maybe you are looking for

  • Can't download 'August Rush'

    I repeatedly get download error 3256 when trying to download August Rush. I don't know if it's related but the only thing that has changed since I last rented something is the upgrade to 2.0.1. Anyone know what this error message meanes? or better st

  • Unable to expand/extend partition after growing SAN-based iSCSI target

    Hello, all. I have odd situation regarding how to expand iSCSI-based partitions. Here is my setup: I use the GlobalSAN iSCSI initiator on 10.6.x server (Snow Leopard). The iSCSI LUN is formatted with the GPT partition table. The filesystem is Journal

  • SFTP receiver channel Archive filename isssue

    Hi, I am working on SAP SFTP adapter (SAP PI7.4). SFTP receiver channel is placing the file with correct filename as generated by dynamic configuration code but sftp channel is adding an extra .txt extension in filename while archiving. Example:     

  • I get a message that my shortcut won't work as the application is moved or deleted when using firefox, reinstall is required to get it back.

    When I reinstall after this message I have my Bookmarks and settings intact. I loose FireFox in all users on the system. Has now happened multiple times.I have the log files and the exact error which I can send if they are needed.

  • Setting up a new iPhone 4

    I have just had delivered a new iPhone from Apple. My existing iPhone 4 (on O2) has been fully backed up onto iTunes on my iMac. Is there a easy to follow tutorial on making the transition from my old to new iPhone, including when to put in my O2 sim