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

7
LINES

< > BotCompany Repo | #1034979 // bwImageToString

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

Transpiled version (8416L) is out of date.

// uses # for black and _ for white
sS bwImageToString(BWImage img) {
  if (img == null) null;
  int w = img.getWidth(), h = img.getHeight();
  ret lines(countIterator(h, y ->
    join(countIterator(w, x -> img.getInt(x, y) >= 128 ? '_' : '#'))));
}

Author comment

Began life as a copy of #1033939

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034979
Snippet name: bwImageToString
Eternal ID of this version: #1034979/4
Text MD5: 301799cb4293e26dd56c3623e81263e2
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-19 20:31:34
Source code size: 255 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 59 / 89
Version history: 3 change(s)
Referenced in: [show references]