Convert an image to *.ico format

Discussion in 'Java' started by angelayoub, Nov 24, 2006.

  1. angelayoub

    angelayoub Guest

    Hello!
    i'm using the API JIMI (Java Image Mangement Interface) and i would like
    to convert any image like gif, jpg, bmp,... to an image *.ico,i have used
    this first part of source code in my program

    Image img=Jimi.getImage("a.jpg");
    Jimi.putImage(img,"a.ico");

    but i have got this Exception "Cannot find encoder for a.ico" when i
    executed my program, after that i have tried to use an other possible
    source code which is

    Jimi.setDefaultFlags(Jimi.VIRTUAL_MEMORY);
    String str="a.jpg";
    String s="a.ico";
    Image img=Jimi.getImage(str);
    File f=new File(s);
    FileOutputStream out = new FileOutputStream(f);
    ICOEncoder ico = new ICOEncoder();
    JimiReader jir=Jimi.createJimiReader(str);
    ico.encodeImage(jir.getRasterImage(),out);

    but i have faced the exception exception of image/x-icone exception it
    require the palette image

    i was wondering if someone would mind helping me to solve this problem or
    giving me any suggestion for help.
     
    angelayoub, Nov 24, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick Olurotimi Ige

    Having favicon.ico instead of IE.ico on a website

    Patrick Olurotimi Ige, Dec 9, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,525
    Martin Dechev
    Dec 9, 2004
  2. Kai Grossjohann

    Transmogrify images (in ICO format)

    Kai Grossjohann, Oct 16, 2003, in forum: Java
    Replies:
    0
    Views:
    375
    Kai Grossjohann
    Oct 16, 2003
  3. Andy
    Replies:
    7
    Views:
    6,291
    Roedy Green
    May 10, 2004
  4. Mel
    Replies:
    1
    Views:
    407
    Steve Pugh
    Mar 9, 2005
  5. bharath
    Replies:
    4
    Views:
    3,274
    Thomas Fritsch
    Mar 16, 2007
Loading...

Share This Page