• Post Reply Bookmark Topic Watch Topic
  • New Topic

BufferedImage to File Object

 
Peter Wolfenstein
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I have a BufferedImage/Byte Array and i need to create a file object out of it, however I must not write the data to a file and then read it into a file ....

So basically I am trying to convert a BufferedImage which is dynamically generated to a instance of File.

Is there a way to do this?

Thanks guys!
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You know that a File object does not represent a file itself? A File object can only be used to be reading from if there is actually a file that the File object points to.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15715
73
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is confusing, so I don't understand exactly what you're looking for. If you just want to write a BufferedImage (which is an image in memory) to a file, then it's very easy to do that with ImageIO. See these examples.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!