Warning: session_start(): open(/var/lib/php/sessions/sess_3gn886gnnijdl5lg27c0f39m5m, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51

Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
get("#348") -- rgb functions get("#175") -- tableToString get("#349") -- table functions w, h = img.width, img.height usenames = true colnames = { ["000"]="black", ["001"]="blue", ["010"]="lime", ["011"]="aqua", ["100"]="red", ["101"]="fuchsia", ["110"]="yellow", ["111"]="white" } count = {} for y = 0, h-1 do for x = 0, w-1 do pix = img.getInt(x, y) r, g, b = rgb(pix) bucket = math.floor(r/128)..math.floor(g/128)..math.floor(b/128) count[bucket] = (count[bucket] or 0)+1 end end colors = keystolist(count) table.sort(colors, function(a, b) return count[a] > count[b] end) r = {} for _, col in ipairs(colors) do c = count[col] percent = math.floor(c/(w*h)*100+0.5) if percent > 0 then table.insert(r, (usenames and colnames[col] or col).."="..percent.."%") end end return "Colors: "..table.concat(r, ", ")