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

16
LINES

< > BotCompany Repo | #347 // Embeddable standard cropper

Lua code

get("#346") -- getcrop

-- works on global "img"
function standardcrop(img)
  local x1, y1, x2, y2 = getcrop(img)

  -- return cropped image
  
  return {
    width = x2-x1,
    height = y2-y1,
    getInt = function(x, y)
      return img.getInt(x+x1, y+y1)
    end
  }
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: #347
Snippet name: Embeddable standard cropper
Eternal ID of this version: #347/1
Text MD5: 2bff6f48ec45d7ce1e3438b86743cd1e
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-01-26 00:24:10
Source code size: 288 bytes / 16 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 542 / 143
Referenced in: [show references]