Code archives/Algorithms/Image Zoom
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
This example zooms in twice the image's original size. To adjust how much it zooms, just adjust the const "zoom". This example reads pixels from the whole screen, making it pretty slow.. Just edit this to read from the size of your image to make it much faster and make room for the max size(once zoomed in). change this line: Global pic=LoadImage("mona.JPG") to the path of the image you want to zoom in on. | |||||
Graphics 1024,768,32,1 Global pic=LoadImage("mona.JPG") Const zoom=2 DrawImage pic,0,0 Dim pix(GraphicsWidth(),GraphicsHeight()) For y=0 To GraphicsHeight() For x=0 To GraphicsWidth() pix(x,y)=ReadPixel(x/zoom,y/zoom) Next Next Cls For y=0 To GraphicsHeight() For x=0 To GraphicsWidth() WritePixel x,y,pix(x,y) Next Next WaitKey() |
Comments
None.
Code Archives Forum