Downloading png images to mobile

what is the best way to download images to the mobile from the server?
can anyone give some link to sample code?

what is the best way to download images to the mobile
from the server?HTTP?
can anyone give some link to sample code?Nicked from the example in HTTPConnection
url = "http://www.example.com/goat.png";
c = (HttpConnection)Connector.open(url);
// Getting the response code will open the connection,
// send the request, and read the HTTP response headers.
// The headers are stored until requested.
rc = c.getResponseCode();
if (rc != HttpConnection.HTTP_OK) {
    throw new IOException("HTTP response code: " + rc);
is = c.openInputStream();
Image myImage = Image.createImage( is );

Similar Messages

  • After installing Fireworks CS3, IE shows the download dialog instead of opening PNG images

    After installing Fireworks CS3, when clicking a link to a PNG
    image, IE displays a download dialog instead of opening the image.
    I am not sure why Fireworks becomes the default file handlers of
    PNG and GIF without asking or notifying the user during
    installation, but I think this is the cause.
    Does anybody know how to fix the problem?
    Thanks,
    Franklin Tse

    Fireworks uses a form of .png as its native file format
    (which many people find unfortuante) The Fireworks format includes
    some additional information, allowed by the specification, so you
    want to make sure that, if you want a .png for the Web, you
    export from you Fireworks image, not just
    save.
    In any case you can re-associate the file types. Exactly how
    you re-associate file types depends on your OS.
    In Vista, right click on a .gif and select 'Properties.'
    Under 'Type of file', click on the 'Change'
    button and change the associate application. Make sure the
    checkbox next to 'Always use the selected program to open this kind
    of file' is checked.

  • Downloaded the most current version and PNG images will not show

    I'm running XP with SP3 and the most current versions of Firefox and IE8. I have the AdBlock add on. PNG images do not appear (on either browser) only blank spaces where a picture should be.
    == This happened ==
    Every time Firefox opened
    == I updated my computer to SP2 and current browsers

    Hello Scott.
    Try reading these support articles:
    http://support.mozilla.com/en-US/kb/Websites+look+wrong
    https://support.mozilla.com/en-US/kb/Images+or+animations+do+not+show
    I hope it helps.

  • How to convert PNG image to Vertor Image to make font on Mac

    Hi Mac People,
    I like to create a set of font, and I have made them in a image editing tool, I have FontForge downloaded but decide to use it to convert instead direct design them inside.
    So now I don't know how to convert the PNG image to vector image required by the FontForge, I read some post mentioned Ubuntu has utilities to convert, but I'm not sure OS X has that function too.
    Could anyone let me know how to convert PNG so I can create my fonts?
    If PNG can't, the software can export TIFF or jpeg or similar.
    Please help me, I need make them this few day.
    Thanks everyone for giving me a hand!

    take a look at:
    http://developers.sun.com/techtopics/mobility/midp/articles/picture/

  • I want to download and image from the url and image is in byte format

    hi
    i want to download the image from the url:
    http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
    can any one help me to do this i need to finish this today plz help me.
    first 5 character 09593 is the length of the image we need to substract image length from total length.
    thanks in advance
    M.Raj
    Edited by: Mraj.Bangalore on May 15, 2008 12:01 AM
    Edited by: Mraj.Bangalore on May 15, 2008 12:01 AM

    hi
    thanks for the reply,
    that works only if .png file is there in the path.
    i worked it out, it is working fine now
    try
                   httpConn = (HttpConnection)Connector.open(url);
                   is=httpConn.openInputStream();
                   responseCode = httpConn.getResponseCode();
                   if(httpConn.getResponseCode() == 200)
                             ByteArrayOutputStream bStrm = null;
                             byte[] data = new byte[512];
                             int contentLen = httpConn.getHeaderFieldInt("Content-Length", 0);
                             if(contentLen > 0)
                                  response = new byte[contentLen];
                             else
                                  bStrm = new ByteArrayOutputStream();
                             int count = 0, tmp =0;
                                  while ((count = is.read(data)) >= 0)
                                       if( contentLen > 0 )
                                            for(int i=0;i<count && tmp+i < contentLen;i++)
                                                 response[tmp+i] = data;
                                            tmp += count;
                                       else
                                            bStrm.write(data, 0, count);
    //                                    if( aborted)
    //                                         break;
                                  data = null;
                                  System.gc();
                                  if( contentLen <= 0 )
                                       response = bStrm.toByteArray();
                                       bStrm.close();
                                       bStrm = null;
                                       System.gc();                                   
                        else
    //                          main.showAlert("ERROR","Connection failed.Please access again later");
    //                          main.changeToMain();
              catch(Exception e){
                   response = null;
                   responseCode = 0;
    //                main.showAlert("ERROR","Connection failed.Please access again later");
    //                main.changeToMain();
              catch(OutOfMemoryError e){
    //                main.showAlert("ERROR","Not enough memory, please disable some apps or delete files and try again.");
    //                main.changeToMain();
              finally
                   System.out.println("Before Creation"+response.length);
                   img = Image.createImage(response, 5, response.length-5);
                   System.out.println("After Creation");
                   CanvasImageFile canvas = new CanvasImageFile(this);
                   midlet.display.setCurrent(canvas);
                   try
                        if( is != null )
                             is.close();
                             is=null;
                   catch(Exception ex){
    //                     main.showAlert("ERROR","Connection failed.Please access again later");}
                             if( httpConn != null )
                             try {
                                       httpConn.close();
                                  } catch (IOException e) {
                                       // TODO Auto-generated catch block
                                       e.printStackTrace();
                             httpConn=null;

  • JPEG images on mobile

    How can i display JPEG images on mobile phone (i.e. Nokia3410)? Can i use JPEGDecoder for this purpose and will it work? If anyone has allready written this code can you provide me with piece of it.

    I tried the server route, but a 30kb JPEG becomes a 210kb PNG, and for downloading over the air on a cell phone, that 7x increase is a painful problem. Downloading the JPEG directly to the J2ME device is definitely the way to go. Pretty lame that J2ME doesn't currently support JPEG natively.
    After many nights of searching the Net for an answer to this question, a kind soul pointed me to the following site, which is 80% of the answer we're looking for:
    http://webuser.fh-furtwangen.de/~dersch/
    Helmut Dersch
    has written/ported a JPEG Decoder that can run in J2ME:
    JPEGDecoder: pure-Java JPEG-Decoder for limited Java APIs (e.g. J2ME)I know that it works (he has a sample app that actually runs on my Treo with a panoramic JPEG image loaded from the resource files). Unfortunately, I haven't been smart enough to write the code yet that would download a JPEG off the web and render it on the screen (without all the Panoramic stuff). Should be simple, though.
    I am sure that it will take 90 seconds for one of you smart folks. If you actually write the code to do this, PLEASE post the source code so that all of us will learn!
    Thanks!!!

  • I am trying to use photomerge compose.  I open one standard jpeg image and one image that is my business logo in a png format.  When I select the png image, to extract the logo from it, it appears as all white and will not allow me to select the logo from

    I am trying to use photomerge compose.  I open one standard jpeg image and one image that is my business logo in a png format.  When I select the png image, to extract the logo from it, it appears as all white and will not allow me to select the logo from it.  It has worked in the past but I downloaded the update today and photomerge will not work correctly.  Any ideas?

    hedger,
    How do you expect anyone to help when we don't know a darned thing about the file, abut your setup, exact version of Photoshop and your OS, machine specs, etc.?
    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • I want to download an image from the url and image is in byte format

    hi
    i want to download an image from the url
    http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
    first 5 digits will be the length of the image,we need to download except first 5 digits and display an image file
    i need to finish this today
    pla reply if any body knows solution for this.
    thanks in advance
    Mraj

    You do not need to do anything - iPhoto always keeps the original and you can revert to it at any time
    If you want to be able to see the original and the cropped version in iPhoto at the same time duplicate the photo (this does not really duplicate but simply starts a new edit stream for the photo - command-d) and crop the duplicate
    LN

  • Displaying the .png image stored in an byte array

    Hi,
    I have to download an .png image from a server and i have to store it in a byte array and i have to display this byte array in another servlet. I have written the code to get the image from the remote server in a java class. The java class returns the byte array of the image and i have to display that in an servlet.
    If anybody has the code or any refrence to refer please help me..
    Thanks & Regards
    -Sandeep

    I have pasted code for servlet's doGet method which writes image data...
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws
    ServletException, IOException
    HttpSession session = request.getSession(); //taking httpsession
    response.setContentType("image/jpeg");
    ServletOutputStream out = response.getOutputStream(); //taking outputstream of response
    if (rtn.getErrorCode() == 0)
    //this will actually write image file data from where it is being called
    //byte array will contain image data, please load your image into below byte array variable
    byte[] b = new byte[100];
    out.write(b);
    out = null; //making null
    session = null; //making null
    In other servlet, write <img> tag and specify its src attribute to the "name of servlet where u have pasted above code" ..
    Regards,
    Nikhil

  • Transparency in png image not showing

    Hello,
    I have a Region, which needs a background and an image 'on top' of it.
    I can set the background using
    setStyle("-fx-background-color: #" + 123456 + ";");
    Or I can just use a Rectangle of that colour.
    Then I have an ImageView...   spiralImgView = new ImageView(new Image("images/spiral2.png"));
    The png image itself has some transparency in it.
    So when I add them to the region...
    this.getChildren().addAll(rect, spiralImgView);
    I just get a white background showing behind the image.
    Can anyone help me fix this?
    Thanks

    I didn't do any coding.  This will tell you if it is your image:
    1)  Download and start JavaFX Scene Builder
    2)  Without making any changes paste "-fx-background-color: #1d1d1d;" into the "Style" box of the "Properties" window
    3)  Drag and drop an Image View into the scene from the "Library" window.
    4)  Click on the ImageView in the "Hierarchy" window.
    5)  In the "Properties" window Use the "Image" selector to find your img on disk
    If your image is mostly transparent it's background will not be white but #1d1d1d

  • Problem downloading multiple images in bytearray, Help !

    Hi Everyone,
    I m trying to download multiple images on my mobile as a part of my application.
    On server side I have used System.arraycopy to merge arrays..
    What I did on server side is as follows:
    byte[] seperator={'%'};
    totalImageArray=image1+seperator+image2
    Please note everything is in bytearray.
    Now on client side I m not able to extract two images seperately i.e. bytes before seperator and after seperator.
    how do i do byte to byte comparison ?
    Please guide me as to how I should do this..tips links snippet...??
    Message was edited by:
    siddhsdesai

    Wht dont you send images seperate...
    For example first write the size of first image as bytes and than write the first image. Then write the size of second image as bytes and than write the second image.
    In the client side first read the first number and then read as many as that bytes then create first image. Then read the second number and then read as many as that bytes then create second image.
    Server Side...
    DataOutputStream toClient = new DataOutputStream (....);
    toClient.writeInt(...); //send the sizeof first image as bytes
    toClient.write(...);  //send the first image as byte array
    toClient.writeInt(...); //send the sizeof second image as bytes
    toClient.write(...);  //send the first second as byte array
    toClient.flush();Client Side...
    DataInputStream fromServer= new DataInputStream (....);
    int firstsize=fromServer.readInt(); //read the sizeof first image as bytes
    byte[] image1data=new byte[firstsize]; //image1 buffer
    fromServer.readFully(image1data);  //read the first image as byte array
    int secondsize=fromServer.readInt(); //read the sizeof second image as bytes
    byte[] image2data=new byte[secondsize]; //image2 buffer
    fromServer.readFully(image2data);  //read the second image as byte array

  • How to convert 24bits png image into 8 bits image

    Hi,
    I have gone through some of threads in this forum on changing color bits. But, I still can find right way to change my image (24bits) into different color bits(8 bits). The reason i want to change the color bits because I am getting a GIF image from map server, convert it into PNG format then rescale then into size of mobile phone screen.The PNG image is really has large data length , so the it took a while to load the whole image on screen.
    Note : The following code is taken from few threads in this forum and i have modified it to suit my application.
    I have no idea about Java2d...any help really appreciated...Thanks in advance!!!
    My code is as follow:-
    public File Scale(int width, int height, BufferedImage ImgSrc)
         try
                   //BufferedImage bi = ImageIO.read(ImgSrc);
                   //int w = bi.getWidth(), h = bi.getHeight();
         //Image oldRescale = bi.getScaledInstance(i, j, Image.SCALE_SMOOTH);
         BufferedImage Rescale = rescale(ImgSrc, width, height);
                   //ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
                   //ColorConvertOp op = new ColorConvertOp(cs, null);
                   //Rescale = op.filter(Rescale, null);
         File outfile = new File("map.png");
                   ImageIO.write(Rescale, "png", outfile);
                   BufferedImage fromFile = ImageIO.read(outfile);
                   ColorModel cm = fromFile.getColorModel();
                   System.out.println(cm.getClass() + ", bits/pixel=" + cm.getPixelSize());
              catch(Exception e)
                   e.printStackTrace();
              return new File("map.png");
         public static GraphicsConfiguration getDefaultConfiguration()
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.getDefaultConfiguration();
         public static BufferedImage copyRescaled(BufferedImage tgt, BufferedImage src)
              Graphics2D g2 = tgt.createGraphics();
    int w=tgt.getWidth(), h=tgt.getHeight();
    hintForBestQuality(g2);
         g2.drawImage(src, 0, 0, w, h, null);
         g2.dispose();
    return tgt;
    public static Graphics2D hintForBestQuality(Graphics2D g2)
    g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
              RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    g2.setRenderingHint(RenderingHints.KEY_RENDERING,
              RenderingHints.VALUE_RENDER_QUALITY);
    return g2;
         public static BufferedImage rescale(BufferedImage src, int w, int h)
    int transparency = src.getColorModel().getTransparency();
    GraphicsConfiguration gc = getDefaultConfiguration();
    BufferedImage tgt = gc.createCompatibleImage(w, h, transparency);
    return copyRescaled(tgt, src);

    First, we need to be clear about what you're trying to do -- is it rescale an
    image or insure that the image is saved with a 8bit pixel depth? Or both? You are also
    using GraphicsConfiguration's createCompatibleImage, which is excellent if you are going
    to display the image immediately because it might be hardware accelerated
    or compatible with hardware format, but you mentioned mobile phone screens, so
    there is no advantage to using GraphicsConfiguration in that case, and if fact, it's
    probably changing your ColorModel when you're not looking.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class Example {
        public static void main(String[] args) throws IOException {
            URL url = new URL("http://java.sun.com/developer/technicalArticles/GUI/JavaServerFaces/fig2.gif");
            BufferedImage image = ImageIO.read(url);
            System.out.println("image's colormodel = " + image.getColorModel().getClass());
            BufferedImage rescaled = scaleAndConvertColorModel(image, 0.75, null); //GIF => IndexColorModel
            System.out.println("rescaled's colormodel = " + image.getColorModel().getClass());
            File png = new File("junk.png");
            ImageIO.write(rescaled, "png", png);
            BufferedImage fromFile = ImageIO.read(png);
            System.out.println("fromFile's colormodel = " + image.getColorModel().getClass());
            JPanel cp = new JPanel(new GridLayout(0,1));
            addTo(cp, image, "original image");
            addTo(cp, rescaled, "rescaled image");
            addTo(cp, fromFile, "png file image");
            JFrame f = new JFrame("Example");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setContentPane(cp);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
            Will rescale and convert colormodel if necessary.
            ColorModel == null => don't convert. May return src if suitable.
        public static BufferedImage scaleAndConvertColorModel(BufferedImage src, double scale, ColorModel cm) {
            int w0 = src.getWidth();
            int h0 = src.getHeight();
            int w = (int) (w0 * scale);
            int h = (int) (h0 * scale);
            ColorModel cm0 = src.getColorModel();
            if (cm == null)
                cm = cm0;
            if (w==w0 && h==h0 && cm.equals(cm0))
                return src;
            BufferedImage tgt = createImage(w, h, cm);
            Graphics2D g = tgt.createGraphics();
            if (scale < 1) {
                Image temp = src.getScaledInstance(w, h, Image.SCALE_AREA_AVERAGING);
                g.drawImage(temp, null, null);
            } else {
                hintForBestQuality(g);
                g.drawRenderedImage(src, AffineTransform.getScaleInstance(scale, scale));
            g.dispose();
            return tgt;
        public static BufferedImage createImage(int w, int h, ColorModel cm) {
            if (w <= 0 || h <= 0)
                throw new IllegalArgumentException("...");
            boolean alphaPremultiplied = cm.isAlphaPremultiplied();
            WritableRaster raster = cm.createCompatibleWritableRaster(w, h);
            return new BufferedImage(cm, raster, alphaPremultiplied, null);
        public static Graphics2D hintForBestQuality(Graphics2D g) {
            g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
            g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            return g;
        static void addTo(Container c, BufferedImage image, String title) {
            JLabel label = new JLabel(new ImageIcon(image));
            label.setBorder(BorderFactory.createTitledBorder(title));
            c.add(label);
    }

  • Error in downloading .gif image

    hi frndz
    I am writing an application which downloads the image from server
    for .jpeg, .jpg, .png its working fine but for .gif images it gives me the error: ArrayIndexOutOfBoundException
    Code for downloading Image is:
    ContentConnection connection = (ContentConnection) Connector.open(url);
    DataInputStream iStrm = connection.openDataInputStream();
    // two methods are used to download IMAGE
    // (I) If length available , (II) If length not available
    int length = (int) connection.getLength();
    // (Method I :) ContentConnection includes a length method
    if (length != -1)
    imageData = new byte[length];
    iStrm.readFully(imageData);
    // (Method II :) If Length not available...
    else
    ByteArrayOutputStream bStrm = new ByteArrayOutputStream();
    int ch;
    while ((ch = iStrm.read()) != -1) bStrm.write(ch);
    imageData = bStrm.toByteArray();
    if (bStrm != null) bStrm.close();
    // Create the image from the byte array
    img = Image.createImage(imageData, 0, imageData.length-1);
    When I print Image length its zero and also imageData length is zero
    is there any other method to download .gif images
    thanks
    alpesh

    the problem is not in displaying image
    and by the way i am testing this on N70
    problem is in downloading
    i.e. image length is zero as well asif I dont consider image length the downloaded bytes are zero
    alpesh

  • Display image from BLOB field (png image)

    Hello,
    On my database i have a function which return BLOB (png image from a webservice)..
    Is there some tutorial or sample code how to display a image froma blob field in oracle reports?
    thank you

    You can create a view and base your report on that view. The view would be something like:
    create or replace view my_view as
    select my_blob_function() image
    from ...In your Report it would just be:
    select image
    from my_viewNow, I'm not sure if Reports supports png format, though.
    There are many examples to be found, e.g.
    http://download.oracle.com/docs/html/B10602_01/orbr_dyngraph.htm

  • Problems converting PNG image to SVG with autotrace

    Hi,
    I am trying to convert a large number of color PNG images of hieroglyphs (produced after much effort) to SVG format, using "autotrace -background-color ffffff -output-format svg".
    It seems that where there are closed paths with background color inside, autotrace produces an SVG image with the background area in black instead of transparency. (You can see the images at http://5b4az.chronos.org.uk/pkg/hieroglyph/A001.png and http://5b4az.chronos.org.uk/pkg/hieroglyph/A001.svg although the svg image is not rendered by Firefox). You may also download the tarballs with all the hieroglyphs of the Gardiner set if you are interested.
    After all the effort that went into these images, I am stuck with being unable to convert raster images to vector graphics. I did try autotrace before I put in all this effort, but I didn't notice the problem because apparently I tried it on images with no enclosed background color.....
    Any suggestions wellcome greatefully!
    Last edited by neok (2009-10-17 16:59:31)

    I know this is an old thread, but I did some new testing on some line art and want to post my results.
    I started with a PNG, and converted it to PBM and PGM. I got much better quality doing this conversion with GIMP, as opposed to pngtopnm.
    I traced both formats with autotrace and potrace, which I output to SVG.
    Autotrace accepts PNG, so I did the trace with the original as well.
    I got the highest quality with PGM and potrace.  It also was the smallest file size.
    a close second was PBM with potrace, slightly larger.
    third was autotrace and the PBM, larger still.
    Using the PGM with autotrace was unacceptable, and the file size was HUGE!
    So if black/white is OK: Convert PNG to PGM with GIMP, then potrace
    both the best quality, and smallest size SVG.  This is assuming you started with anti-aliased black/white line-art, i guess the full greyscale PGM avoids the aliasing of PBM.
    It seems autotrace is the way to go, if your forced to deal with multiple colors. 
    I suspect you will need to do many passes and really tweak those command options,
    The PNG directly to autotrace was a complete disaster, but i suspect it would improve given enough time to configure command arguments.
    However, even with those perfect options I would believe potrace yields a cleaner trace.

Maybe you are looking for

  • Script does not work anymore after updating to FM 12.0.3

    Hi, With TCS5, Robohelp would crash when importing FrameMaker books to RH, because the FM files had embedded graphics. So, I found a script to externalize the graphics before doing the import (the script is: ExtendScript of the week: Externalizing Gr

  • Multiple apple ID/Icloud accounts

    Hello, I would like some advice about whether or not this is possible. My wife and I share a macbook pro and an iPad and we both have our own iPhones. We want to set up a joint apple id so that it has its own iCloud drive. This would be so we could a

  • Trying to create a photo gallery... with little knowledge of Flex

    Hey Guys, I am trying build a photo gallery and I am having the hardest time. Is there anything out there that helps people from scratch ? I need help learning where to store the images... IE... jpegs and the right syntax to call up the code... Path

  • Output folder in Flash Builder 4.6 refuses to be anything but relative

    I just updated from Flash Builder 4.5 to 4.6. Things seemed to be going ok in terms of importing all my projects etc. (why can't there be a simple upgrade process rather than a complete uninstall/reinstall process?) But then I got to setting the Outp

  • How to route the Idoc to Two Different Locations based on the Plant Values

    Hi All, We will generate single Idoc, in that we will have 2 E1MARCM segments, one will have UK plant and another will have US plant. Now in XI, receiver determination i need to route the idoc to corresponding folders. How can we do this, because in