The Artima Developer Community
Sponsored Link

Java Answers Forum
how to find acii values of image file in java

1 reply on 1 page. Most recent reply: Feb 26, 2002 11:22 AM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic    
Flat View: This topic has 1 reply on 1 page
jayakumar perumal

Posts: 16
Nickname: jai
Registered: Feb, 2002

how to find acii values of image file in java Posted: Feb 25, 2002 4:12 PM
Reply to this message Reply
Advertisement
hi
i need to find the ascii value of the pixels in an image file for manipulation. i would appreciate if any one can let me know how to do it.


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: how to find acii values of image file in java Posted: Feb 26, 2002 11:22 AM
Reply to this message Reply
The bytes of an image file can be read the same as any other file.

FileInputStream fis = new FileInputStream(filename);
DataInputStream dis = new DataInputStream(fis);
try{
byte b = ' ';
while ((b = dis.readBYte()) != null){
//do something with the char
}
}catch(EndOfFileException eofe){
System.err.println(eof.getMessage());
}catch(IOException ioe){
System.err.println(ioe.getMessage());
}


DataInputStream has several read methods for the various data types.
Most image files are probably in a binary format, requiring you to read bytes instead of characters.

Flat View: This topic has 1 reply on 1 page
Topic: Staroffice document thru Java Previous Topic    

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use