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

11
LINES

< > BotCompany Repo | #1031374 // addBufferedImagesPixelByPixel

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

Libraryless. Click here for Pure Java version (3236L/19K).

// scales second image to size of first
static BufferedImage addBufferedImagesPixelByPixel(BufferedImage img1, BufferedImage img2) {
  int w = img1.getWidth(), h = img1.getHeight();
  BufferedImage img = newImage(w, h);
  BufferedImage img2scaled = resizeImage(img2, w, h);
  for y to h:
    for x to w:
      setRGB(img, x, y, rgbAdd(bufferedImage_getRGB(img1, x, y),
        bufferedImage_getRGB(img2scaled, x, y));
  ret img;
}

Author comment

Began life as a copy of #1031373

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031374
Snippet name: addBufferedImagesPixelByPixel
Eternal ID of this version: #1031374/4
Text MD5: 84db97bfbc0eb4a889166944aa5027b1
Transpilation MD5: 0b40e39983fccacf1435cb7ddde49d50
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-07 12:27:49
Source code size: 440 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 247 / 318
Version history: 3 change(s)
Referenced in: [show references]