aspose file tools*
The moose likes I/O and Streams and the fly likes Converting a byte array into bmp file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Converting a byte array into bmp file " Watch "Converting a byte array into bmp file " New topic
Author

Converting a byte array into bmp file

Jithesh Kumar
Ranch Hand

Joined: Mar 09, 2010
Posts: 46
Hi all,
i am trying to convert a byte array into a bmp file using the following code


While running this code i am getting an error


Thanks in advance,
Jithesh
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19784
    
  20

It seems that imageData does not contain the valid bytes for a BMP file. How have you constructed it?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jithesh Kumar
Ranch Hand

Joined: Mar 09, 2010
Posts: 46
Thank you for responding.

But the length of byte array is giving me the value.

Actually i am getting this byte array from a dcm file(dicom). I am parsing the dcm file and am getting the byte array


Jithesh
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19784
    
  20

DCM isn't BMP, is it?
Jithesh Kumar
Ranch Hand

Joined: Mar 09, 2010
Posts: 46
Actually it will contain bmp image embedded in it.
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

Jithesh Kumar wrote:Actually it will contain bmp image embedded in it.


I see nothing in the DCM (DICOM) specification to say that a DCM file contains an embedded BMP file and even if it did don't you think the BMP image would need to be extracted first so that it could be parsed?


Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting a byte array into bmp file