• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Code for binary file to bitmap file conversion

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
format -- PixelFormat.Format32bppArgb
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 80097
413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 80097
413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At last I am able to convert my .bin file into .bmp file.
This is the code --

 
Campbell Ritchie
Marshal
Posts: 80097
413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic