Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1033069 // imagePixelsToRGBAWithSize

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4000L/23K).

static byte[] imagePixelsToRGBAWithSize(BufferedImage etc img) {
  if (img == null) null;
  int w = img.getWidth(), h = img.getHeight(), n = w*h;
  byte[] out = new[(n+2)*4];
  
  // store width and height
  intToBytes_inArray_littleEndian(w, out, 0);
  intToBytes_inArray_littleEndian(h, out, 4);
  
  // store pixels
  copyIntArrayToByteArray_littleEndian(pixelsOfBufferedImage(img), out, 8);
  ret out;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033069
Snippet name: imagePixelsToRGBAWithSize
Eternal ID of this version: #1033069/2
Text MD5: 4d04ab746f4915af867b0a6e39a45da8
Transpilation MD5: 065e9e5f8a85d26f0e64f058d2877cf7
Author: stefan
Category: javax / compression /pattern recognition
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-13 00:49:12
Source code size: 419 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 149 / 221
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1033124 - imagePixelsToRGBAWithSize_virtualIntList