Convert an image to *.ico format

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2004
Posts: 3
Reputation: ayoub is an unknown quantity at this point 
Solved Threads: 0
ayoub ayoub is offline Offline
Newbie Poster

Convert an image to *.ico format

 
0
  #1
Nov 24th, 2006
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
  1. Image img=Jimi.getImage("a.jpg");
  2. 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
  1. Jimi.setDefaultFlags(Jimi.VIRTUAL_MEMORY);
  2. String str="a.jpg";
  3. String s="a.ico";
  4. Image img=Jimi.getImage(str);
  5. File f=new File(s);
  6. FileOutputStream out = new FileOutputStream(f);
  7. ICOEncoder ico = new ICOEncoder();
  8. JimiReader jir=Jimi.createJimiReader(str);
  9. 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.
Last edited by ~s.o.s~; Nov 25th, 2006 at 9:46 am. Reason: Added code tags, learn to use them yourself
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 4728 | Replies: 0
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC