Libraryless. Click here for Pure Java version (10926L/62K).
static Image2B iBinaryImageToImage2B(IBinaryImage img) { if (img == null) null; if (img cast Image2B) ret img; int w = img.getWidth(), h = img.getHeight(); byte[] pixels = new[(w*h+7)/8]; int i = 0; for y to h: for x to w: { if (img.getBoolPixel(x, y)) pixels[i/8] |= 1 << (i & 7); i++; } ret new Image2B(w, h, pixels); }
Began life as a copy of #1035818
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035822 |
| Snippet name: | iBinaryImageToImage2B |
| Eternal ID of this version: | #1035822/4 |
| Text MD5: | cf4b3c8bea97f5ac4cc3948334d589d2 |
| Transpilation MD5: | f70ed4079054318b5d3b8ee147c64512 |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-08-01 23:50:48 |
| Source code size: | 382 bytes / 15 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 356 / 467 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |