aspose file tools
The moose likes Java in General and the fly likes BufferedImage from FileOutputStream Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "BufferedImage from FileOutputStream" Watch "BufferedImage from FileOutputStream" New topic
Author

BufferedImage from FileOutputStream

RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi All,
i want to get a BufferedImage but I have a FileOutputStream Object with me. Can anyone tell how do I get it?


Regards,<br />Roshani
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12911
    
    3

A FileOutputStream is for writing to a file. Did you mean you have a FileInputStream object, for reading from a file?

The easiest way to read an image from a file is using the ImageIO API:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi Jesper,
Thanks for your reply adn apology if I was not clear in my question.
I have a FileOutputStream object adn I want to convert it to a BufferedImage as the new encode() takes BufferedImage instead of FileOutputStream (that was used earlier).

FileOutputStream fos = null;
fos = new FileOutputStream(actualImagePath,false);
if (fos != null) {customBean.encode(<BufferredImageRequired> ;
I cannot change the approach to maintain backward compatibility.

Is there a way we can do this?
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12911
    
    3

That's not possible. Can you explain more about the project you're working on? Do you understand exactly what the encode(...) method is supposed to do in the context of the project?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BufferedImage from FileOutputStream
 
Similar Threads
applet x/y coordinates
Help for java ImageIO API for PNG Images
Java ImageIO API with PNG image compression
Image -> BufferedImage
Image compression code