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

13
LINES

< > BotCompany Repo | #1024558 // img_distanceFromColor

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

Libraryless. Click here for Pure Java version (2607L/16K).

static BWImage img_distanceFromColor(RGBImage img, RGB color) {
  int w = img.getWidth(), h = img.getHeight();
  int col = color.getInt();
  BWImage bw = new(w, h);
  for y to h:
    for x to w:
      bw.setPixel(x, y, rgbDiff(img.getInt(x, y), col));
  ret bw;
}

static BWImage img_distanceFromColor(BufferedImage img, RGB color) {
  ret img_distanceFromColor(RGBImage(img), color);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024558
Snippet name: img_distanceFromColor
Eternal ID of this version: #1024558/2
Text MD5: a04a986b1f114af2f79c7d494c7e6827
Transpilation MD5: dd56c224530e801a2e522880bb7e687a
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-18 13:17:42
Source code size: 398 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 184 / 253
Version history: 1 change(s)
Referenced in: [show references]