Code archives/Graphics/ResizeImage(img,w,h,frame)
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
This is another function of my gui. it rescales an image to an x|y width of a certain frame(default=0) | |||||
Function ResizeImage(image, newwidth, newheight, frame = 0) tbuffer = GraphicsBuffer() oldwidth = ImageWidth(image) oldheight = ImageHeight(image) ni = CreateImage(newwidth + 1, oldheight) dest = CreateImage(newwidth, newheight) SetBuffer ImageBuffer(ni) For x = 0 To newwidth DrawBlockRect image, x, 0, Floor(oldwidth * x / newwidth), 0, 1, oldheight, frame Next SetBuffer ImageBuffer(dest) For y = 0 To newheight DrawBlockRect ni, 0, y, 0, Floor(oldheight * y / newheight), newwidth, 1 Next FreeImage ni SetBuffer tbuffer Return dest End Function |
Comments
None.
Code Archives Forum