Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

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"));
  
}
}
Comment

PREVIOUS NEXT
Code Example
Java :: Java Multiple element Annotations 
Java :: java singleton design pattern 
Java :: How to disable special characters on keyboard in android 
Java :: java swing place objects vertically 
Java :: convert java code to kotlin online 
Java :: differance entre appel implcite et explicite en java 
Java :: aaa testing java 
Java :: priorityQueue peek java 
Java :: problem solving using recursion in java 
Java :: convert kotlin to java online 
Java :: how to compare two characters in java 
Java :: math.round java 
Java :: set preference value android 
Java :: how to set current item for spinner android 
Java :: @entity annotation in spring boot 
Java :: java resto 
Java :: java sort array int 
Java :: java tamanho de um vetor 
Java :: java swing date picker 
Java :: what is java steam 
Java :: print prime numbers in java 
Java :: LocalRegistry java rebind() java8 
Sql :: today minus 15 days postgresql 
Sql :: convert utc to est sql 
Sql :: start postgresql 
Sql :: alter table column change data type to text mysql 
Sql :: how to edit table name in mysql 
Sql :: how to remove tables from postgresql 
Sql :: get the next auto_increment value mysql 
Sql :: possgress drop if exists table 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =