You are here

tiles to files

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!
script-fu-tiles-to-files.scm6.43 KB

Partitions an image into tiles (with, optionally, either gaps or overlaps between them) and then writes each tile as a separate jpeg file.

An alternative method of doing the same thing would involve first setting up a grid of guides (eg,, then using Image->Transform->Guillotine (as noted here:, and then saving each of the generated images to a file.

ONE MOTIVATION: At winkflash today, you can buy 4x6 inch prints for six cents each; so you could buy 36 of them for $2.16, and tile an area of size 24x36 inches. But to buy a single 24x36 inch print will cost about $20. Of course, the two aren't exactly equivalent, but what this script provides is a quick way to produce the separate jpeg files.


As well as generating the files, it (by default) also makes an auxiliary image in a new window where each tile is a separate layer. There is an option to delete the auxiliary image deleted before you ever see it, but it might be useful if you want to check that the tiles are reasonable, or if you want to do some further processing to the individual tiles. Otherwise, you'll probably want to close that image, when you are sure that the jpegs are what you wanted.

If you give a blank filename, then files are not generated. You can still do that manually from each of the layers in the auxiliary image.

The tiles will always be the same size even if that means that a few pixels are dropped off the right or bottom margins. (By contrast, depending on how you do it, setting up guides and using Guillotine will get all the pixels, but some images will be slightly different sizes.)


This is almost identical to a setting up of regular guides, followed by the Image->Transform->Guillotine function.

The individual jpeg files lose the EXIF info from the original file. (I don't really understand all the parameters to file-jpeg-saveand I also remark that the Guillotine approach doesn't have this problem.)

That the output can only be jpeg is probably a bug; the user might prefer other file formats, or (at the least) to be able to adjust the jpeg quality parameter.

Only works on RGB images; should probably extend to GRAYSCALE, etc.

I've limited this to 100x100 tiles. It's an arbitrary limit, but I'd think it should be plenty.

The number of overlap/gap pixels is limited to 200, again arbitrary and capricious. Also, the number is the same for horizontal and vertical.

It might be better to do this in two steps. First generate the image of tiles. Then (if you are happy with them) generate the files. A separate routine that did layers-to-files might be useful in its own right.

Code License: 
GIMP Version: 
Scripting Engine: 


And easy to port to save as PNG.

Subscribe to Comments for "tiles to files"