944,030 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 6048
  • Java RSS
Nov 24th, 2006
0

Convert an image to *.ico format

Expand Post »
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
Java Syntax (Toggle Plain Text)
  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
Java Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
ayoub is offline Offline
3 posts
since Mar 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Incompatible types error
Next Thread in Java Forum Timeline: Calculating distance between pixels





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC