Libraryless. Click here for Pure Java version (3244L/19K).
// scales second image to size of first // interprets second image as 50% brightness meaning zero static BufferedImage addBufferedImagesPixelByPixel_minus50(BufferedImage img1, BufferedImage img2, double factor default 1) { 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: { RGB a = bufferedImage_getRGB(img1, x, y); RGB b = bufferedImage_getRGB(img2scaled, x, y); setRGB(img, x, y, rgb( a.r+(b.r-0.5)*factor, a.g+(b.g-0.5)*factor, a.b+(b.b-0.5)*factor)); } ret img; }
Began life as a copy of #1031374
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031379 |
Snippet name: | addBufferedImagesPixelByPixel_minus50 |
Eternal ID of this version: | #1031379/3 |
Text MD5: | 29c32b9221cef1fa328657955abca654 |
Transpilation MD5: | dde408724422d3889f1d645d547c1445 |
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:31:40 |
Source code size: | 654 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 203 / 291 |
Version history: | 2 change(s) |
Referenced in: | [show references] |