• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

number of bytes in BufferedImage object

 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic