Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting a byte array into bmp file  RSS feed

 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21087
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that imageData does not contain the valid bytes for a BMP file. How have you constructed it?
 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21087
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DCM isn't BMP, is it?
 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually it will contain bmp image embedded in it.
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!