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

11
LINES

< > BotCompany Repo | #485 // containsColor

Lua code

function containsColor(img, color)
  local w, g = img.width-1, img.getInt
  for y = 0, img.height-1 do
    for x = 0, w do
      if g(x, y) == color then
        return true
      end
    end
  end
  return false
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: #485
Snippet name: containsColor
Eternal ID of this version: #485/1
Text MD5: 2eccda4b79ac70fecadd0e249fafc5c9
Author: stefan
Category: image functions
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-03-04 22:40:31
Source code size: 226 bytes / 11 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 594 / 159
Referenced in: [show references]