// contrast=1 => original // contrast=2 => twice as contrasty // contrast=.5 => half as contrasty static BWImage bwContrast(double contrast, BWImage bw) { if (contrast == 1 || bw == null) ret bw; int w = bw.getWidth(), h = bw.getHeight(); BWImage bw2 = new BWImage(w, h); for y to h: for x to w: bw2.setPixel(x, y, (float) (0.5+(bw.getPixel(x, y)-0.5)*contrast)); ret bw2; }
Began life as a copy of #1015507
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018878 |
Snippet name: | bwContrast - adjust contrast of BWImage |
Eternal ID of this version: | #1018878/5 |
Text MD5: | f27ebf520248bd8a0aa89981151528a4 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-24 12:02:14 |
Source code size: | 398 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 311 / 357 |
Version history: | 4 change(s) |
Referenced in: | [show references] |