function math.round(x) return math.floor(x+0.5) end
newwidth=math.round(width*zoom)
newheight=math.round(height*zoom)
newpixels = {}
for y=0,newheight-1 do
for x=0,newwidth-1 do
newpixels[y*newwidth+x+1] = pixels[math.floor(x/zoom)+math.floor(y/zoom)*width+1]
end
end
width=newwidth
height=newheight
pixels=newpixels
newpixels=nilzooms 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: | 1645 / 554 |
| Referenced in: | [show references] |