1 | function math.round(x) return math.floor(x+0.5) end |
2 | |
3 | newwidth=math.round(width*zoom) |
4 | newheight=math.round(height*zoom) |
5 | newpixels = {} |
6 | |
7 | for y=0,newheight-1 do |
8 | for x=0,newwidth-1 do |
9 | newpixels[y*newwidth+x+1] = pixels[math.floor(x/zoom)+math.floor(y/zoom)*width+1] |
10 | end |
11 | end |
12 | |
13 | width=newwidth |
14 | height=newheight |
15 | pixels=newpixels |
16 | newpixels=nil |
zooms an image!
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
Recognizer | Recognition Result | Visualize | Recalc |
---|---|---|---|
#308 | 356 | [visualize] |
Snippet ID: | #104 |
Snippet name: | Zoomer |
Eternal ID of this version: | #104/1 |
Text MD5: | 0981701af0d1de6301091126cb049e82 |
Author: | stefan |
Category: | image tools |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2014-01-09 01:27:57 |
Source code size: | 356 bytes / 16 lines |
Pitched / IR pitched: | Yes / Yes |
Views / Downloads: | 1336 / 461 |
Referenced in: | [show references] |