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).

1  
// scales second image to size of first
2  
static BufferedImage addBufferedImagesPixelByPixel(BufferedImage img1, BufferedImage img2) {
3  
  int w = img1.getWidth(), h = img1.getHeight();
4  
  BufferedImage img = newImage(w, h);
5  
  BufferedImage img2scaled = resizeImage(img2, w, h);
6  
  for y to h:
7  
    for x to w:
8  
      setRGB(img, x, y, rgbAdd(bufferedImage_getRGB(img1, x, y),
9  
        bufferedImage_getRGB(img2scaled, x, y));
10  
  ret img;
11  
}

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: 248 / 320
Version history: 3 change(s)
Referenced in: [show references]