Libraryless. Click here for Pure Java version (3244L/19K).
1 | // scales second image to size of first |
2 | // interprets second image as 50% brightness meaning zero |
3 | static BufferedImage addBufferedImagesPixelByPixel_minus50(BufferedImage img1, BufferedImage img2, double factor default 1) { |
4 | int w = img1.getWidth(), h = img1.getHeight(); |
5 | BufferedImage img = newImage(w, h); |
6 | BufferedImage img2scaled = resizeImage(img2, w, h); |
7 | for y to h: |
8 | for x to w: { |
9 | RGB a = bufferedImage_getRGB(img1, x, y); |
10 | RGB b = bufferedImage_getRGB(img2scaled, x, y); |
11 | setRGB(img, x, y, rgb( |
12 | a.r+(b.r-0.5)*factor, |
13 | a.g+(b.g-0.5)*factor, |
14 | a.b+(b.b-0.5)*factor)); |
15 | } |
16 | ret img; |
17 | } |
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: | 204 / 292 |
Version history: | 2 change(s) |
Referenced in: | [show references] |