• Post Reply Bookmark Topic Watch Topic
  • New Topic

Read JPG header  RSS feed

 
Graziani Gabriele
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i've to read a JPG header, can u help me doing it?
How can i read the stream of byte componing a jpg image?
It's better using a FileReader or a FileInputStream, or anything else, what's the difference?
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please don't post the same question to multiple forums.
InputStreams and OutputStreams deal in raw, uninterpreted bytes, while Readers and Writers deal in characters, which must be interpreted according to some character-set encoding. For your application, then, you must use FileInputStream.
 
Graziani Gabriele
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've extract bytes from a jpg stream using:
FileInputStream fis=new FileInputStream("image.jpg");
BufferedInputStream bis=new BufferedInputStream(fis);
int l=bis.available();
byte [] b=new byte[l];
bis.read(b);
Now i'd like to convert this bytes into text for example to get header information of the jpg file. How cai i do?
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know anything about the format of JPG files; to interpret the data, you would have to, of course. If you don't know anything about the format either, the first step would be to learn; you can find what you need to know at this site.
Now, given this knowledge, can you express more precisely what you need to extract from the file -- i.e., 4-byte little-endian integers, IEEE double-precision float, ASCII strings? And all at particular offsets, of course?
 
Graziani Gabriele
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link.now i try and i'll inform u as soon as possible
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!