File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes create ImageIcon from bytes[], not from file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "create ImageIcon from bytes[], not from file" Watch "create ImageIcon from bytes[], not from file" New topic
Author

create ImageIcon from bytes[], not from file

Brian Tarbox
Greenhorn

Joined: Nov 24, 2003
Posts: 1
I want to create an image icon, but not from a jpg or gif file. Rather, I have a 2d array of bytes that I want to display on a canvas.
ImageIcon has a constructor that takes byte[] but only if that array was "read from an image file containing a supported image format".
Is there a way to do this?
Brian Tarbox
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
By the way, where did u get the 2D array of bytes? Is it sure that the array you have represents a certain kind of ImageIcon? If not, even tough we construct an ImageIcon using that array, we will not be able to see the icon...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: create ImageIcon from bytes[], not from file