Convert base 64 code to Image/ImageIcon

Hi,
suppose we have a base 64 code characters that we need to process and convert to Image file
i suppose we need first to convert base 64 code to byte array then convert byte array to image. is that right ?
can someone describe me how to implement this feature ?
thankin you.

Well, you've pretty much described what you need to do. Where are you getting stuck? Base 64 decoding is a little tricky to get right, but there are existing classes that do what you need. I think if you look at the Java Mail package there is a Base 64 decoder in there. Or just google "base 64 decoder java".
Good luck.

Similar Messages

  • Converting  JAVA  code to JSP

    Hi every one, I am new to JSP I have a code in JAVA which is used to generate an image from a temporary file of size 34.1MB.
    I am unable to convert that JAVA code into JSP,can anyone help me in this regard
    Here is my code
    import java.awt.image.*;
    import java.io.*;
    import java.util.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class ExampleCreate {
        public static void main(String[] args) throws Exception {
            final int H = 2530;
            final int W = 3630;
            int[] pixels = createPixels(W*H);
            BufferedImage image = toImage(pixels, W, H);
            display(image);
            ImageIO.write(image, "jpg", new File("static.jpg"));
      static int[] createPixels(int size) throws Exception{
           int[] pixels = new int[size];
           int[] colors = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,102,104,106,108,110,112,114,116,118,120,122,124,126,0xff0000,0x00ff00,0x0000ff,0x00000f,0xfff000,0xff00ff,0xffffff,0xf00000};
           FileReader fr = new FileReader("SST.tmp");
           BufferedReader br = new BufferedReader(fr);
           String text = br.readLine();
           int c = 0;
           for(int i = 0; i < size; ++ i){
                     text = br.readLine();
                     c = Integer.parseInt(text);
                     if(c < 0)
                          c = 0;
                     pixels[i] = colors[c];
           br.close();
       return pixels;
        static BufferedImage toImage(int[] pixels, int w, int h) {
            DataBuffer db = new DataBufferInt(pixels, w*h);
            WritableRaster raster = Raster.createPackedRaster(db,
                w, h, w, new int[] {0xff0000, 0xff00, 0xff}, null);
            ColorModel cm = new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
            return new BufferedImage(cm, raster, false, null);
        static void display(BufferedImage image) {
            final JFrame f = new JFrame("");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new JLabel(new ImageIcon(image)));
            f.pack();
            SwingUtilities.invokeLater(new Runnable(){
                public void run() {
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }thanks&regards
    Mahender

    According to me just convert ths code to servlet and instead of displaying the image with BufferedImage just stream it (the image) to the browser. This will be useful to catch the general idea.

  • How to convert HTML text to image

    Hi all!
    I&acute;m having this problem: I have a html code (dynamic generated) and I need to convert it to a image, any idea how to do that?
    Thanks, J.

    Im no Java2D expert but if you want the actual code as an image couldnt you just use 'drawString("<br>", x, y)' to display it and then allow it to be saved as an image, I know theres built in capability in Java to import/export common image formats. Or do you mean you want what the html actually produces as an image?
    Ken

  • CONVERT BASE 36 TO DECIMAL

    Any Vi to CONVERT BASE 36 TO DECIMAL?

    Here's the explanation:
    The math behind the value is quite simpe: base^position, where the first position left of the decimal sign is 1.
    Ton
    Message Edited by TonP on 11-13-2008 08:21 AM
    Message Edited by TonP on 11-13-2008 08:21 AM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    Base 36_BD.png ‏8 KB

  • Win7 Base Imange + Addon Images - Am I doing this right?

    Ok here is my setup
    ZCM 11
    I created a base win 7 image. It has the default 100mb partition 1 boot
    and he 2nd partition for all the main win 7 stuff (C: drive) etc
    I created a Pre Boot Bundle
    Image script - all it does is img -pd all to clear any existing images
    Win7 Base - Zenimage
    Win7 addon unattend - Zenimage (used zen image explorer to extract these
    as add on image)
    Win7 addon nwclient - zenimage (used zen image explorer to extract these
    as add on image)
    BUT i think when the above runs it is placing the addon images (or
    trying to) to the first partition when it should be placing it in the
    2nd partition.
    How can I do this correctly
    IF i do it in aenworks maintenance mode using the gui manually it works
    (cause I selected advanced options to make sure ADDON was select)
    how do I do that in the bundle?
    Any ideas suggestions

    I create the Windows 7 image with both the 100mb boot partition and the "c: drive" partiton already in it. The other images that you use have to be done in one of two different ways.
    If you are streaming a secondary image (I do that to include the Novell and ZENWorks client files) then I create the image with zmgexp with two partitions. The first partition is empty. The second contains the directories and files for the Novell and ZENWorks clients. This will always put the files that you want on the "c: drive".
    If you are using addon partitions in a script, you don't have to setup two partitions in them. You can just use the command line to direct the partition in the image to whatever partition you want locally.
    Here is my script that I run to push down drivers for a specific image after the main OS and Novell client images have been multicast.
    Code:
    # This will auto detect the System Model and install appropriate image #
    #Path for driverbase on server sleszen:/var/opt/novell/zenworks/content-repo/images
    driverbase=addons/
    #Set cpumodel
    cpumodel=`dmidecode -s system-product-name`
    #Model specific image to Windows partition (p2)
    img rp $PROXYADDR "$driverbase$cpumodel.zmg" a1:p2
    reboot
    The relevant line is - img rp $PROXYADDR "$driverbase$cpumodel.zmg" a1:p2
    This directs the image partition a1 to the local partition p2

  • Creating a PDF from Word 2010 doesn't correctly convert text boxes and images

    I have Acrobat 11 and my co-workers with 9 and 10 can correctly convert Word docs with images and text boxes, but v.11 cuts off the text and doesn't convert images correctly.

    Hi Anubha,
    I tried exporting by printing through the "File" menu as well as using the ribbon menu bar in Word 2010. Results were still not good. Below is the original Word File and then what I got when I tried to export using those two methods. I've also tried running the "Repair Acrobat Installation", but that didn't help.
    -Luke
    Original File
    1. Converting using "File" menu
    2. Converting Using Acrobat Tab in Ribbon in Word 2010

  • Convert as2 code to as3

    Please help me to convert this code..............
    for (i = 1; i <= nextballs; i++)
            nextarray[i] = new Array(0, 0, 0);
            attachMovie("balls", "nextballs" + i, kkk++);
            _loc2.inGame["nextballs" + i]._x = xnext;
            _loc2.inGame["nextballs" + i]._y = ynext + i * 60;
            _loc2.inGame["nextballs" + i]._xscale = 140;
            _loc2.inGame["nextballs" + i]._yscale = 140;

    var nextballs:int = 4;  // <- nextballs needs to be defined, though need not be defined this way.
    for (var i:int = 1; i <= nextballs; i++)
            var nextarray[i]:Array = new Array(0, 0, 0);
    this["nextballs"+i]=new balls();
    addChild(this["ballballs"+i]);
    // xnext and ynext need to be defined and should probably be updated in this for-loop
    // this part of your code makes no sense given your attachMovie() statement.
            _loc2.inGame["nextballs" + i].x = xnext;
            _loc2.inGame["nextballs" + i].y = ynext + i * 60;
            _loc2.inGame["nextballs" + i].scaleX = 1.4;
            _loc2.inGame["nextballs" + i].scaleY = 1.4;

  • How do i get a Base code (Material) from a description through BOM?

    Hi,
    the right base code(material) for the production order '68647' is 100827 descriotion 'PIPE BASIC' .
    my requirement is i have an production order and relevent plant, how do i get a basecode ?
    from my previous finding i read that All BOMs will have are associated with the description.
    Targeting this description will always return the right base code for the order.
    but i did not get any idea out of it.
    Please tell me how do i get a Base code (Material) from a description through BOM?
    Thanks in advance.
    Edited by: gulab zehra on Sep 22, 2009 9:17 AM

    Hi Keven,
    I had a look at the example "programmaticbuild2.vi" that you can find at this link:
    in this application the error that eventually comes out from the "BuildTargetBuildSpecification.vi" is written in the error_log.txt through a case structure.
    You can change the code inside the Error case if you want to handle the error in a different way. For example you could connect the error wire to a General Error Handler, that displays a message if an error occurs, or you could light up a led that inform you the error has occurred.
    Best regards,
    Serena M.

  • Jsp code for image compression

    Hai,sir this is surendra i am doing a project using jsp and mysql.
    In that each user can put his image and i am storing that image in mysql blob but that results to that database size.
    So i need jsp code for image compression or another way for storing images.

    There's no need to store images in db. You may store them in a dedicated folder.

  • How to convert Doc file into image

    hello frnds
                     Can any body guide me how to convert doc file into image and show into swf loader.
    actually i have to convert doc files into swf files in runtime so that i have to use this flow.
    is it possible to convert doc file into byte array and than convert into image.
    Thanks And Regards
        Vineet Osho

    You can convert any DisplayObject to byeArray using this function ImageSnapshot.captureBitmapData().getPixels()

  • Convert mouse position to image position

    Using a zoomed IMAQ image in an image control, I want to recover the position of the mouse in the co-ords of the underlying image. LastMousePositionX (and Y) give the info I want but they are one click in the past and not the current position. Amazingly, there doesn't appear to be an equivalent CurrentMousePositionX. I can't seem to find the info I need to do the conversion manually. The mousedown event returns the current mouse position and I can get the position in the image container by subtracting off its left and top position. But to convert this to the image position I need to know both the zoom and where the images origin is relative to what is displayed. I can't seem to find that origin position in the list of property nodes. The only thing I can seem to come up with is to extract the info from teh image information string, but this seems like an incredibly poor way to extract such obvious information - espeically since the info must be calculated to put in the string anyway. Can anyone help with this?

    Hi,
    I am confused why you get the mouse position one click in the past because it seems to work ok for me. I've had to use four of the image properties to recreate the effect using the mousemove event, but this seems to give the same values as the Last Mouse Position property so I think it does what you want. I couldn't see an origin property so I did the conversion using the position given at the image center. I wanted to post a snippet here but I'm new to posting and couldn't seem to get it to work for the whole block diagram, so I'm using a screenshot instead. I hope this helps in some way.
    Will
    Attachments:
    mouse position test.vi ‏58 KB

  • Convert PDF Page to Image format

    Is there any way to convert PDF page to Image formats (like JPG, GIF...)?
    I am looking in iTextSharp. If there are other options also, please let me know.

    There is a sample included with the Acrobat SDK that shows how to perform conversions of PDFs to other formats. There are also other options available to plug-ins such as PDPageDrawContentsToMemory() and then using an image library of your choice to save the bitmap data into various image formats.
    > I am looking in iTextSharp
    This is the Acrobat SDK forum - for questions regarding coding using the Acrobat SDK. Have you considered asking this in an iTextSharp forum if you are limiting yourself to that product?

  • Convert HTML codes to RTF

    Hi,
    In a Java Servlet, I need to convert HTML codes into an RTF/word document.
    Any help for some related Java API ?
    Regards,
    Priya Ranjan Sahay
    Message was edited by:
    Priya Ranjan Sahay

    Checkout iText:
    http://www.lowagie.com/iText/
    Example code:
    http://www.java-tips.org/other-api-tips/itext/manipulating-pdf,-rtf,-or-html-documents-with-java.html

  • 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...

  • Convert ABAP code to a flowchart

    Is there any tool that can Convert ABAP code to a flowchart? Please give  me the details like download link if there any.
    Please help

    Is there any tool that can Convert ABAP code to a flowchart? Please give  me the details like download link if there any.
    Please help

Maybe you are looking for

  • Can I use 1333GHZ memory in a machine that uses 1066GHZ memory

    Can I use 1333GHZ memory in a machine that uses 1066GHZ memory

  • Changes in logical components of a project

    Hi I have the requirement to add another system to my maintenane project.  Having read Dolores Correa's Usual Questions and known errors blog I see that this is not s straight forward scenario. The blog states that I should "Close the current project

  • XFCE popup message in panel not appearing

    after upgrade to last XFCE release i seem to be unable to see the popup messages from items on panel such as Network monitor. I hover with mouse cursor over it but nothing appears. Anyone had similar happening?

  • Mail Exchange Error

    Hi, I have two Exchange accounts. One is setup in Entourage and the other uses Mail. I added the Exchange account I use in Entourage to the 3g iphone. Plugged it in to my mac and had no problem. Plugged the phone in last night and the account in Mail

  • Oracle Sequence Vs autoincrement feature in cold fusion-Weird error!!!

    When a oracle sequence is used with cold fusion there is a problem with sequence generation. It generates sequence like "5,4,6,5...."etc. It works fine when using the autoincrement feature. Our application demands using the sequence from oracle. Have