Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public BufferedImage ARGBByteToBufferedImage(byte[] imgBuff, int w, int h){
- BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
- int[] ARGB_Data = new int[w * h];
- for(int i = 0, k = 0; i < ARGB_Data.length; i++, k = k + 4){
- int A = (imgBuff[k] << 24) & 0xFF000000;
- int R = (imgBuff[k + 1] << 16) & 0x00FF0000;
- int G = (imgBuff[k + 2] << 8) & 0x0000FF00;
- int B = (imgBuff[k + 3]) & 0x000000FF;
- ARGB_Data[i] = A | R | G | B;
- }
- img.setRGB(0, 0, w, h, ARGB_Data, 0, w);
- return img;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement