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

10
LINES

< > BotCompany Repo | #348 // rgb functions

Lua code

function rgb(i)
  local r = bit32.band(bit32.rshift(i, 16), 255)
    local g = bit32.band(bit32.rshift(i, 8), 255)
    local b = bit32.band(i, 255)
  return r, g, b
end

function bright(r, g, b)
  return (r+g+b)/(255*3)
end

test run  test run with input  download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #348
Snippet name: rgb functions
Eternal ID of this version: #348/1
Text MD5: f271f57d9b63385de6c588273f73b0ed
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-01-26 00:24:41
Source code size: 232 bytes / 10 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 795 / 480
Referenced in: #332 - Schwerpunktfinder
#335 - Horizontal Signature
#345 - Horizontal split with crop
#350 - RecogUtil 2
#357 - Aibo finder v2
#358 - Aibo finder v4
#361 - Aibo finder v5
#363 - Magic Wand Algorithm
#369 - Magic Wand Algorithm (optimized & including magicWandAll)
#371 - Brightness range (contrast)
#372 - Brightness range (contrast), embeddable
#376 - Image Hasher using MD5 (disabled for now)
#380 - hashImage (include)
#382 - Icon Printer
#383 - Battery Symbol Finder
#391 - Battery Level Extractor
#393 - Battery Charging?
#394 - Battery Symbol Finder (optimized)
#395 - Battery Charging? (unoptimized)
#398 - Magic Wand Algorithm (optimizing)
#399 - Magic Wand All, optimizing
#400 - Magic Wand All, optimizing II (profiling)
#401 - Magic Wand All, optimizing III (faster x movement)
#402 - Magic Wand + Hashes (optimized III)
#403 - Magic Wand + Hashes (one column)
#404 - Magic Wand + Hashes (column range, improving)
#405 - Magic Wand + Hashes for Internet menu
#406 - Magic Wand + Hashes (special case recognizer)
#407 - Grid Recognizer
#408 - Grid Recognizer (optimization)
#409 - Grid + Floodfill
#411 - Grid + Floodfill with hashes
#413 - Symbol Finder (include)
#415 - Rough-Hash Function
#416 - Grid + Floodfill with rough hashes
#417 - stringRepImage (include)
#418 - Grid + Floodfill with string rep
#420 - Grid + Floodfill with hashes / limited start area (for start menus)
#421 - Grid + Floodfill with hashes / limited start area (for start menus), optimized
#422 - Grid + Floodfill with hashes (with virtual stack)
#423 - Grid + Floodfill with hashes (hacked for galculator)
#424 - LXTerminal Contents Finder
#425 - LXTerminal Contents Segmenter
#426 - LXTerminal Contents Recognizer
#427 - LXTerminal character reference maker
#428 - LXTerminal Contents Finder (include)
#429 - LXTerminal character reference maker 2
#430 - makeIcon
#432 - LXTerminal Contents Recognizer 2
#437 - LXTerminal Contents Recognizer 2 (cursor line only)
#438 - LXTerminal Contents Recognizer 2 (repeatable)
#439 - LXTerminal Contents Recognizer 2 (cursor line only, repeatable)
#442 - Grid + Floodfill with hashes (size 3)
#444 - White Grid + Floodfill
#445 - White Grid
#446 - White Spaces (include)
#449 - Heat map (vertical)
#453 - Java character reference maker
#455 - Java source recognizer
#456 - Java character reference maker (non-bold)
#458 - Grid Recognizer (size=3)
#459 - Grid Recognizer (size=2)
#461 - Grid + Floodfill with hashes (size 2)
#463 - Grid + Floodfill (size = 50)
#464 - Grid + Floodfill (size = 15)
#465 - Grid + Floodfill (size = 10)
#466 - Color buckets
#469 - Grid + Floodfill with hashes (for lighter elements)
#470 - Grid Recognizer (for lighter elements)
#472 - Vertical split with crop
#475 - Tolerant horizontal split with crop
#476 - Haiku font recognizer (collecting data)
#477 - Haiku font recognizer (testing)
#478 - Horizontal split with crop (include)
#479 - Embeddable border finder (getcrop2)
#480 - Horizontal split with crop 2 (include)
#481 - Haiku font recognizer (include)
#493 - Triangle detector (standing on bottom)
#494 - Rectangle detector (must be black & cropped)
#496 - Triangle detector (standing on bottom, include)
#497 - Rectangle detector (include)
#501 - Triangle detector (standing on bottom, include, optimized)
#507 - averageBrightness (function)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)