File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes number of bytes in BufferedImage object Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "number of bytes in BufferedImage object" Watch "number of bytes in BufferedImage object" New topic
Author

number of bytes in BufferedImage object

Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
If I have a BufferedImage object, is there a good way to get the number of bytes that are in it without writing it out to a file? Or do I have to convert it to a String and then convert that to a byte array and then get the length?

Currently, I write this BufferedImage out to a file, and I notice that when I use ImageIO's write method, it specifies the format as PNG or whatever. But I need to change this to use ImageIO's write method that writes out the BufferedImage to a stream, and the method that this stream gets sent to needs to know the length in bytes for something else. Problem is, I'm wondering if it's possible for you to know the length in bytes before you write it out into a particular format (PNG or whatever). So will I have to write this out to a temp file no matter what?
[ December 22, 2004: Message edited by: Stephen Huey ]
 
I agree. Here's the link: jrebel
 
subject: number of bytes in BufferedImage object
 
Similar Threads
Deserializing Visual Basic 6 files in Java?
Image Processing
basic, I think: get InputStream from OutputStream for image
difficulty storing BufferedImage in Oracle BLOB field
Convert PDF to JPG, byte streams