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

16
LINES

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

Lua code

1  
get("#346") -- getcrop
2  
3  
-- works on global "img"
4  
function standardcrop(img)
5  
  local x1, y1, x2, y2 = getcrop(img)
6  
7  
  -- return cropped image
8  
  
9  
  return {
10  
    width = x2-x1,
11  
    height = y2-y1,
12  
    getInt = function(x, y)
13  
      return img.getInt(x+x1, y+y1)
14  
    end
15  
  }
16  
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: 602 / 168
Referenced in: [show references]