Help please - Splitting images into pieces
Posted on 2002-04-13
what I need is to split an image file(.bmp, .jpg, .gif, .tiff) into a predefined number of pieces(image files in the same file format). All pieces to have the same image size.
The ideal solution will be
function split_img(img_path, divide_X, divide_Y)
where img_path is the path to the image file to be splitted.
divide_X, divide_Y will define how many pieces to split the image into
If called like
split_img("C:\Test\img.gif", 3, 2)
the result should be 6 gif files named img1...img6.gif, each of them having an width of img.gif_width/3 and heigth of img.gif_heigth/2, saved in the same folder where the original file is.
If img.gif is let's say 1000x1000 pixels, the result should be 6 files 333x500 pixels.