Horje
convert text file into binnary format bitmap using java Code Example
convert text file into binnary format bitmap using java
import java.awt.image.BufferedImage;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Test3 {
public static void main(String[] args) throws IOException {
  
 
int i =0;
int w = 320;
int h = 240;
int  imageData[] = new int[w * h];
  
FileInputStream file_input = new FileInputStream ("D:\\abc.bin");
DataInputStream data_in    = new DataInputStream (file_input );
  
while (true) {
  try {
  imageData[i++] = data_in.readInt ();
     
  }
  catch (EOFException eof) {
    System.out.println ("End of File");
    break;
  }
}
BufferedImage finalImage;
finalImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);//TYPE_INT_ARGB
finalImage.setRGB(0, 0, w, h, imageData, 0 ,w);
ImageIO.write(finalImage, "bmp", new File("D:\\abc.bmp"));
  
}
}




Java

Related
Automatic Code Completion in NetBeans Code Example Automatic Code Completion in NetBeans Code Example
bukkit console filter Code Example bukkit console filter Code Example
public string tostring() { Code Example public string tostring() { Code Example
before first method in jdbc Code Example before first method in jdbc Code Example
how to declare variable in android Code Example how to declare variable in android Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7