Encode and Decode the Image

Hi,
I have a requirement like to encode the image(anyone of type:-jpg.gif) byte Array and placed into XML file.
I can use this xml file as datasource in BIRT,decode the byte data and bind to Image.
so I need to encode and decode the Image with predefined Libraries,
Could anyone Help to me.
Thanks and Regards
Swetha.

Get the name of the file.
Read the file as bytes
Encode the bytes as base64 string
Insert name into a XML element
Insert base64 into a XML element
Reverse to extract.
Image libraries have nothing to do with that process.

Similar Messages

  • Encode and Decode 16 bit grayscale image to jpeg2000

    i am trying to convert 10 bit grayscale raw image to jpeg 2000 using J2KImageWriter and i want it to convert back to grayscale raw image but when i am converting it it gives NULL.
    Here is my code
    public class Main {
    public static void main(String[] args) {
    if(args.length!=4)
    System.out.println("\nEnter imagefile height width header\n");
    System.exit(0);
    String filename=args[0];
    int height=Integer.parseInt(args[1]);
    int width=Integer.parseInt(args[2]);
    int header=Integer.parseInt(args[3]);
    try
    //reading the image data
    FileInputStream imagefile=new FileInputStream(filename);
    System.out.println("\nSize of image file:"+imagefile.available());
    System.out.println("\nHeader:"+String.valueOf(header)+" bytes\n");
    imagefile.skip(header);
    short pixels[]=new short[height*width];
    int i,j,k;
    k=0;
    for(i=0;i<height;i++)
    for(j=0;j<width;j++)
    int lsb=imagefile.read();
    int msb=imagefile.read();
    pixels[k]=(short)(msb<<8 | lsb);
    k++;
    //System.out.println(String.valueOf(pixels[i][j]));
    imagefile.close();
    DataBuffer buffer=new DataBufferUShort(pixels,width*height);
    SampleModel sm=RasterFactory.createBandedSampleModel(DataBuffer.TYPE_USHORT,height,width,1);
    Raster raster=RasterFactory.createWritableRaster(sm, buffer,new Point(0,0));
    //imagedata reading complete
    //conversion to jpeg 2000
    String outfile=args[0].substring(0,args[0].lastIndexOf('.'))+".jp2";
    File outimage=new File(outfile);
    ImageOutputStream imout=ImageIO.createImageOutputStream(outimage);
    J2KImageWriteParam j2kparam=new J2KImageWriteParam();
    J2KImageWriterSpi spi=new J2KImageWriterSpi();
    J2KImageWriter j2kwriter=new J2KImageWriter(spi);
    j2kparam.setLossless(true);
    j2kparam.setComponentTransformation(false);
    j2kparam.setEncodingRate(0.5f);
    j2kparam.setFilter(J2KImageWriteParam.FILTER_53);
    j2kparam.setNumDecompositionLevels(3);
    j2kparam.setWriteCodeStreamOnly(true);
    j2kwriter.setOutput(imout);
    j2kwriter.write(null,new IIOImage(raster,null,null),j2kparam);
    imout.close();
    J2KImageReaderSpi j2kspi=new J2KImageReaderSpi();
    J2KImageReader j2kreader=new J2KImageReader(j2kspi);
    ImageInputStream imin=ImageIO.createImageInputStream(outfile);
    j2kreader.setInput(imin, true, false);
    Raster decomp_raster=j2kreader.readRaster(1, null);
    int outputdata[]=new int[width*height];
    decomp_raster.getPixels(0,0,width,height,outputdata);
    FileOutputStream fileout=new FileOutputStream("decomp");
    for(i=0;i<height*width;i++)
    short temp=(short)outputdata;
    fileout.write(Short.valueOf(temp).byteValue());
    Short a=new Short(Short.reverseBytes(temp));
    fileout.write(a.byteValue());
    fileout.close();
    catch(Exception e)
    System.out.println(e.getMessage());
    Can anybody help me with this. Actually i need to study the performance of jpeg2000 compression using different setting of parameters.
    Thanks in advance.......

    Hi,
    I am able to encode and decode the image using J2Kwriter and J2Kreader classes. But now some other issue has came up.
    When compressed losslessly, the new jpeg2000 filesize is 415245 bytes. (My original file is of size 2000000 bytes)
    But when i am doing lossy compression, it results in following file sizes.
    Below 0.5 (encoding rate) - 535 bytes.
    Greater than or equal to 0.5 - 541 bytes.
    I tried with the following values of encoding rate - 0.1, 0.3, 0.5, 0.8, 1, 1000, 100000000, 500000000.
    I m not able to understand why i am getting the same filesize even with different encoding rate.
    How should i set the encoding rate parameter to achieve my target compression ratio.
    Kindly guide me. I will be very thankful to you.
    Preeti

  • Encode and Decode

    Hai,
    Can i encode the URL rewriting and decode in next page.
    example,
    Qutation.jsp?atdmin_status=y";
    in qutation.jsp can i decode that url for re using the request
    But i want to show some text in URL .is it possible?plz give sample code
    Regards,
    john jayaraj

    Hi,
    I am able to encode and decode the image using J2Kwriter and J2Kreader classes. But now some other issue has came up.
    When compressed losslessly, the new jpeg2000 filesize is 415245 bytes. (My original file is of size 2000000 bytes)
    But when i am doing lossy compression, it results in following file sizes.
    Below 0.5 (encoding rate) - 535 bytes.
    Greater than or equal to 0.5 - 541 bytes.
    I tried with the following values of encoding rate - 0.1, 0.3, 0.5, 0.8, 1, 1000, 100000000, 500000000.
    I m not able to understand why i am getting the same filesize even with different encoding rate.
    How should i set the encoding rate parameter to achieve my target compression ratio.
    Kindly guide me. I will be very thankful to you.
    Preeti

  • Best practice for encoding and decoding DUT/UUT registers? Class? Cluster? Strings? Bitbanging?

    I am architectecting a LabVIEW system to charactarize silicon devices.  I am trying to decide the best way to enqueue, encode, and decode device commands executed by my test system.
    For example, a ADC or DAC device might come in both I2C and SPI flavors (same part, different interface) and have a large register map which can be represented as register names or the actual binrary value of it's address. 
    I would like my data structure to
    *) be protocol agnostic
    *) have the flexibility to program using either the memonics or hard coded addresses
    *) be agnostic to the hardware which executes the command. (
    *) I would like to enqueue mulitple commands in a row.
    I am thinking a detailed class is my best bet, but are there are examples or best practices already established?

    I agree on the detailed class inherited from a general DUT-class. Especially if you want to mix interfaces you need to keep those as far away from your top vi as possible.
    As to the 4th point i'd implement command-vi's as enque and have a in-class command-queue (or possibly just an array of commands).
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Encode and Decode Base64

    Hi All,
    I need to Encode and Decode Base64 File. 
    Please let me know if there is any Function Modules or Class Methods to achieve the requirement.
    Thanks in advance.
    Regards
    Joseph
    Message was edited by: Joseph Brown

    Hi,
    This is the encoded base64 file in XML format:
    <?xml version="1.0" encoding="UTF-8"?>
    <Z_CREFO_DOC>
    <E_PDF><![CDATA[JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURlY29k
    ZT4+CnN0cmVhbQp4nE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b2R1Y2VyKEdQTCBHaG9zdHNjcmlwdCA4LjE1KQovQ3JlYXRpb25E
    YXRlKEQ6MjAwNjAzMjExMjExMTYpCi9Nb2REYXRlKEQ6MjAwNjAzMjExMjExMTYpCi9UaXRsZShN
    aWNyb3NvZnQgV29yZCAtIERva3VtZW50MSkKL0NyZWF0b3IoUFNjcmlwdDUuZGxsIFZlcnNpb24g
    NS4yKQovQXV0aG9yKG11ZWxsZXJoKT4+ZW5kb2JqCnhyZWYKMCAxNAowMDAwMDAwMDAwIDY1NTM1
    IGYgCjAwMDAwMDA0NjYgMDAwMDAgbiAKMDAwMDAwMjM5OSAwMDAwMCBuIAowMDAwMDAwMzk4IDAw
    MDAwIG4gCjAwMDAwMDAyMzUgMDAwMDAgbiAKMDAwMDAwMDAxNSAwMDAwMCBuIAowMDAwMDAwMjE2
    IDAwMDAwIG4gCjAwMDAwMDA1MTQgMDAwMDAgbiAKMDAwMDAwMjE2MCAwMDAwMCBuIAowMDAwMDAx
    ODE3IDAwMDAwIG4gCjAwMDAwMDA1NTUgMDAwMDAgbiAKMDAwMDAwMDU4NSAwMDAwMCBuIAowMDAw
    MDAwNjE1IDAwMDAwIG4gCjAwMDAwMDE3OTYgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSAxNCAv
    Um9vdCAxIDAgUiAvSW5mbyAyIDAgUgovSUQgWyityXEclVXSeoKdpGR5FFwppSkorclxHJVV0nqC
    naRkeRRcKaUpXQo+PgpzdGFydHhyZWYKMjU5NgolJUVPRgo=]]>
    </E_PDF>
    <C_ERROR></C_ERROR>
    </Z_CREFO_DOC>
    Can i pass all these characters or i need to transform it first, extract the value of the element and decode? Finally i need to write the decoded outcome to a file (a pdf file) to the hard drive (may be with: OPEN DATASET P_DATASET FOR INPUT IN TEXT MODE ENCODING DEFAULT)
    I saw this hint but I think there should be more to it (eg. transformation of the initial decoded xml file and the writing it to hard drive using the Open Dataset for Input...):
    ****************being of report *************************
    DATA: z       TYPE string,
          encode  TYPE string,
          decode  TYPE string .
    DATA: obj  TYPE REF TO cl_http_utility,
          cref TYPE REF TO if_http_utility.
    CREATE OBJECT : obj.
    cref = obj.
    z = 'what u have to encode'.
    encode = obj->if_http_utility~encode_base64( z ) .
    decode = obj->if_http_utility~decode_base64( encode ).
    ****************end of report ***************************
    What do i need more to the above report

  • URL Encode and Decode

    Hi Experts,
    My Oracle Version:
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production         
    PL/SQL Release 11.1.0.7.0 - Production                                         
    CORE     11.1.0.7.0     Production                                                     
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production                        
    NLSRTL Version 11.1.0.7.0 - Production                                         
    5 rows selected.I got the requirement to check any URL encode and decode methods available in common for O racle and PHP,
    Since URL will be encoded in database at the time of retreiving data from database but it will be decoded in PHP without db connection.
    Hope my scenario will be clear to you, is any common function available in oracle and php for this process?

    but escape, unescape just adds %20 for empty space in the URLwell it does a bit more: it escapes all special characters that should not be in a URL, e.g.
    SQL> select utl_url.escape('#^|%µ ') escaped_url from dual
    ESCAPED_URL                                                                    
    %23%5E%7C%25%B5%20                                                             
    1 row selected.Can you give an example of how you want a completely converted url, and why?

  • Audio encoding and decoding

    hello,
    i am doing a voice-chat application.i badly need to reduce the size of the recording ,compress the audio.i have not been able to get a mixer which supports a-law or u-law encoded compression by default ;all mixers support the 16 bit PCM.please suggest a way to encode and decode in a-law or u-law.

    Please don't post in threads that are long dead and don't hijack other threads. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.
    I'm locking this thread now.

  • QT SDK. Use encoder and decoder simultaneously

    We develop a software for video conversion. When we tried to convert QT DV to QT DV with different settings the SDK don't work properly. I guess that some conflict occurs when we use encoder and decoder simultaneously.
    Is is known bug? Is there any workaround?

    http://jakarta.apache.org/commons/codec/

  • What encoder and decoder recommend in Yosemite?

    I use iTunes and VLC to play all the Videos as usual.. So what encoder and decoder do you recommend better in Yosemite?

    None.
    OS X includes most that you need and VLC can handle what it can't.

  • Base 64 Encoding and Decoding

    Hi,
    I am in need of a standard Java API from either sun's implementation or from SAP's implementation to perform Base64 encoding and decoding...
    Can someone please provide me the links to get the same ?
    Thanks & Regards,
    Gurushant S.H

    Hi Gurushant,
    first, welcome on SDN forums!
    About your question: See SAP's Base64 secKey encoding
    Hope it helps
    Detlev
    PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!

  • Base40 encode and decode

    Hi
    I'm looking to compress (and decompress) some already short strings (think about the same amount of text as a search engine might show for a result).
    One of the most effective ways of compressing short strings seems to be base 40 encoding as found in the accepted answer here: http://stackoverflow.com/questions/7389252/shorten-an-already-short-string-in-java
    At least against my data, it seems to outperform LZF and Smaz.
    However, I can't for the life of me figure out how to decode it. I've even found encode and decode implementations in C, but my C is woefully inadequate to derive the Java: http://www.drdobbs.com/embedded-systems/slimming-strings-with-custom-base-40-pac/229400732
    To show willing, here's one of many attempts at writing a method to decode it:
         public String unpack(byte[] input) { //FIXME: No workie.
              ByteArrayInputStream bois = new ByteArrayInputStream(input);
              DataInputStream dis = new DataInputStream(bois);
              StringBuilder sb = new StringBuilder();
              char a,b,c;
              try {
                   while ((a = dis.readChar()) != '\0' && (b = dis.readChar()) != '\0' && (c = dis.readChar()) != '\0') {
                        sb.append(chars.charAt(a % 40));
                        sb.append(chars.charAt(b / 40 % 40));
                        sb.append(chars.charAt(c / 40 / 40));
              } catch (IOException e) {
                   throw new AssertionError(e);
              return sb.toString();
    Could anyone help me out? Thanks in advance.

    Welcome to the forum!
    >
    Could anyone help me out? Thanks in advance.
    >
    Thanks for posting the code that you tried.
    Problem #1 in your code is that you are not following the instructions from the author for decoding
    >
    Read each pair of bytes as a char ch. The first index is ch % 40, the second is ch / 40 % 40 and the last is ch / 40 / 40. Use chars to turn the index into a char. Note; I have swap the order in the code to make it simpler to decode. A 0 means you have reached the end.
    >
    You are reading three characters. Each pair of bytes represents THREE characters. You need to reach ONE character (one pair of bytes) and then break it up into three characters.
    Problem #2 is in the author's code. There is no '0' at the end. The author's code does not add a zero at the end to indicate the end of the string. The author's code also shows that some byte arrays are an odd number of characters long. That means you CANNOT read each pair as there may be a single remaining byte.
    Since you posted the code you were trying I was able to create code that works.
    I created a decode method and call it from the main method and print out the decoded results.
    import java.util.Arrays;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.IOException;
    class Encoder {
        public static final int BASE = 40;
        StringBuilder chars = new StringBuilder(BASE);
        byte[] index = new byte[256];
        {     chars.append('\0');
          for (char ch = 'a'; ch <= 'z'; ch++) chars.append(ch);
          for (char ch = '0'; ch <= '9'; ch++) chars.append(ch);
          chars.append("-:.");
          Arrays.fill(index, (byte) -1);
          for (byte i = 0; i < chars.length(); i++)
            index[chars.charAt(i)] = i;
        public byte[] encode(String address) {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                DataOutputStream dos = new DataOutputStream(baos);
                for (int i = 0; i < address.length(); i += 3) {
                    switch (Math.min(3, address.length() - i)) {
                        case 1: // last one.
                            byte b = index[address.charAt(i)];
                            dos.writeByte(b);
                            break;
                        case 2:
                            char ch = (char) ((index[address.charAt(i+1)]) * 40 + index[address.charAt(i)]);
                            dos.writeChar(ch);
                            break;
                        case 3:
                            char ch2 = (char) ((index[address.charAt(i+2)] * 40 + index[address.charAt(i + 1)]) * 40 + index[address.charAt(i)]);
                            dos.writeChar(ch2);
                            break;
                  return baos.toByteArray();
            } catch (IOException e) {
                throw new AssertionError(e);
        public static void main(String[] args) {
            Encoder encoder = new Encoder();
            byte [] encodedBytes;
            String decodedString;
            for (String s : "twitter.com:2122,123.211.80.4:2122,my-domain.se:2121,www.stackoverflow.com:80".split(",")) {
                encodedBytes = encoder.encode(s);
                System.out.println(s + " (" + s.length() + " chars) encoded is " + encodedBytes.length + " bytes.");
                decodedString = encoder.decode(encodedBytes);
                System.out.println("Decoded String is [" + decodedString + "].");
        public String decode(byte[] input) { //FIXME: No workie.
            ByteArrayInputStream bois = new ByteArrayInputStream(input);
            DataInputStream dis = new DataInputStream(bois);
            StringBuilder sb = new StringBuilder();
            char a,b,c;
            int index;
                try {
            for (int i = 0; i < input.length / 2; i++) {
                    a = dis.readChar();
                    index = a % 40;
                    if (index == 0) break;
                    sb.append(chars.charAt(index));
                    index = a / 40 % 40;
                    if (index == 0) break;
                    sb.append(chars.charAt(index));
                    index = a / 40 / 40;
                    if (index == 0) break;
                    sb.append(chars.charAt(index));
            if ((input.length % 2) != 0) {
                index = dis.readByte();
                if (index != 0) sb.append(chars.charAt(index));
                } catch (IOException e) {
                    throw new AssertionError(e);
            return sb.toString();
    twitter.com:2122 (16 chars) encoded is 11 bytes.
    Decoded String is [twitter.com:2122].
    123.211.80.4:2122 (17 chars) encoded is 12 bytes.
    Decoded String is [123.211.80.4:2122].
    my-domain.se:2121 (17 chars) encoded is 12 bytes.
    Decoded String is [my-domain.se:2121].
    www.stackoverflow.com:80 (24 chars) encoded is 16 bytes.
    Decoded String is [www.stackoverflow.com:80].

  • Images I move from one folder into another are disappearing, at first it was occurring immediately if I did not copy and paste the images. Today however I found out that images I had been using for days just up and vanished from their new location.

    Images I move from one folder into another are disappearing, at first it was occurring immediately and only if I did not copy and paste the images. Today however I found out that images I had been using for days just up and vanished from their new location. A few of these images had copies in another folder that remained and the ones I couldn't find may or may not have ever had copies. I had backed up my system with time machine recently as well, so I went into the backup to retreive the lost images. When I searched and found the backup copies I got the error "the file alias cannot be opened because the original cannot be located". The crazy thing is that the images that remained on my computer did not give me the same error and opened like they should.
    In short images that I am creating, saving, and using are disapearing so epically that even time machine versions are affected when retrieval is attempted. Any suggestions as to what I could be doing wrong without realizing it? Or perhaps other people have had similar bugs that are software related and have a solution?

    Hi Kevin,
    I understand what you tried to do but it doesn't work that way. Swapping drive names will just mess things up.
    You should be able to reconnect the files though: in the Locate Referenced Files dialog make sure you click the Show Reconnect Options button — this will give you access to all the connected drives. Locate one of the files and hit Reconnect All. Should do the trick.
    Best

  • Image instead of List Name, and hyperlink the image to view 'All Items.aspx' page

    Hi,
    I would like remove the Page title for list (i.e., name of the list in view all items.aspx page) , and instead use image and hyperlink the image
    to 'All items.aspx" page.
    Using developer tool found the element (#PageTitle) and added 'Script Editor' webpart and below css script to it. I am successful in replace the
    title to image, however, I am unable to add the HTML tag for hyperlink. Where do I need to add or how do I add? Could anyone help me please??
    <style type="text/css">
    #pageTitle
    background-image: url('http://w2k81368:2116/SiteAssets/Test.jpg');
    background-repeat:no-repeat;
    text-indent: 100%;
    white-space: nowrap;
    </style>
    Regards,
    Sunitha

    Hi Sunitha,
    According to your description, my understanding is that you want to change the list title to an image.
    I recommend to add the code below to the list page:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script><script type="text/javascript">
    $(document).ready(function (){
    var s = "<img alt='SP' src='http://w2k81368:2116/SiteAssets/Test.jpg'>";
    var $t = $("#DeltaPlaceHolderPageTitleInTitleArea span span a");
    $t.html(s);
    </script>
    After that, the list title will change to the image and it will show allitems.aspx page when clicking the image.
    Thanks,
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

  • How to upload the image and diplay the image in the browser using jsp

    How to upload the image and diplay the image in the browser using jsp
    thanks
    shan

    i'll suggest looking for sample code or tutorial with a relevant query in google, which as far more time than us to answer this type of reccurent question

  • How do I save pages from my website in PDF, and prove the image was capture on a given date?

    How do I save pages from my website, [link removed] into a PDF file, with proof of the date the pdf file was created on? I need to display the content of each unique url of my site in PDF format for compliance purposes, and prove the image was taken from a given date. Anyone can help that would be great.

    Impossible to do with Reader. If you own Acrobat and use Create PDF from Webpage. The document will have a creation date. If you then sign the pdf on the date of creation, you have proof of when the document was created and proof that the document wasn’t altered since signed.

Maybe you are looking for

  • After upgrading to Yosemite I had to upgrade iPhoto and now it says I need to update my photo library or it will be lost...HELP

    After upgrading to Yosemite, I had to upgrade iPhoto.  Now when I try to open iPhoto I get the following message: The photo library needs to be upgraded to work with this version iPhoto. Your photo library will not be readable by previous versions of

  • Sending photos from iphone

    is there a way to select and send multiple photos??? if not there should be. my problem is that i sent 7 photos individually to my work address. i tried opening in photoshop but after the first 2, the program only updated the image to the next one in

  • PSE 8 emails in cyberspace

    I am running pse 8 under Windows 7.  I have my email preference set as Adobe email service.  In about the last 3 weeks, my emails have stopped appearing(I send the emails via the share pane to myself in Windows Live Mail and then forward them using W

  • No moveable columns in JTable

    Hello to all!!!!! I speak spanish I am working with a jTable in which the idea is to take information from a DB and to show it by this component. But it is that the columns of the table can be changed of position and be changed the size of them. So t

  • Service Materials PO

    Hi Gurus, I need help in the following questions. 1)When do we need to create Service Master (AC03) and when we can select a suitable NLAG material for services in a PO? 2) If we put item category "D" in the PO, can we skip the material field and cre