Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Code for binary file to bitmap file conversion

 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a file that have .bin extension and i need to convert it into .bmp code.
Can any body provide me the exact code for this type of conversion.
 
Satish Chilukuri
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.bin files are generally CD/DVD images. Is that the kind of file you have?
 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually right now i do not have binary file.
If we assume that it is a video or image then provide me solution according to that.
 
Satish Chilukuri
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without knowing the file type, there is no way to do any conversion. I still don't understand what you mean convert to a bitmap file. Are there images like .jpg, .png in the .bin file and you need to convert them to bmp format? If it is a video file how are you going to convert it a bmp file? Do you mean to extract individual frames and save them as bmp?
 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a 10-15 .bin files that are the frames generated from a video.
Now i need to write down a code that will change that files into .bmp files.
Please help me soon.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are many ways to store an image in a file. As Satish mentions, without knowing which format the images are in, we can't give advice on how to convert them.
 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know about the header-footer of image.
Please provide me any sample code for .bin to .bmp conversion.
I am using AIR technology that is responsible to create frames and store them into .bin file.
 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any body convert this c# code into java.
(This code is converting .bin file into .bmp)

 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
format -- PixelFormat.Format32bppArgb
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by swati mittal:
Can any body convert this c# code into java.


NotACodeMill
Why don't you have a go and then let us know if you get stuck anywhere.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49396
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by swati mittal:
Can any body convert this c# code into java.
I am willing to convert that bit to Java. It readsYou ought to be able to convert the rest of the code without a lot of effort; remember C# and Java are very similar. You will have to alter some of the names of classes, lose the "using" keyword, and in Java Thread.sleep() declares a checked Exception, but the whole job ought not to be too difficult.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49396
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
I am willing to convert that bit to Java. It reads[CODE]


Sorry, I made a mistake. It should read data.length not data.Length.
 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C# code is using class "BitmapData". But java does not contain any class which can work like BitmapData.
 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At last I am able to convert my .bin file into .bmp file.
This is the code --

 
Campbell Ritchie
Sheriff
Pie
Posts: 49396
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done. ( ) C# code really looks like Java code, doesn't it.
 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes it looks like a java.
But I faced lot of problems because some classes are available in C# but not in java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic