Posts: 6,338
Threads: 272
Joined: Oct 2016
Reputation:
562
Operating system(s):
Gimp version: 2.10
08-09-2017, 09:15 PM
(This post was last modified: 12-12-2017, 11:27 PM by Ofnuts.)
The place to discuss ofn-tiles (still fairly experimental as this thread is started) and ofn-export-layers
ofn-tiles and ofn-export-layers are available here (as separate packages).
So, you have a layer, ofn-tiles will cut it into X by Y tiles (you give the number of tiles of each direction), and save each tile in a
specified directory. ofn-tiles in accessed via Layer>Save as tiles.
Name of the tiles: the file names of the tiles are obtained by inserting the row and column number of the tile (or its sequence number) in a string that your provide. The place where these numbers are inserted are indicated by names in braces:
- row0, row1 is the row number of the tile. When using "row0" the first row is 0 and when using "row1" the first row is 1.
- column0, column1 is the column number of the tile. Ending in 0,1 is same as above
- tileRC0,tileRC1, tileCR0,tileCR1, is the tile number. Ending in 0,1 is same as above. The *CR has the rows scanned first so tiles 1, 2, 3 are in the first column while the *RC has the columns scanned first, and tiles 1,2,3 are in the first row.
- the string is the complete name of the file and should have an image format extension (png, gif, jpg...) since it will be used by Gimp to determine how to save the file. The defaults settings for the file type are used.
- the name pattern is actually a Python format, so modifiers can be used. For instance {row0:03d} will insert the row number on at least three digits, with zeroes added to the left if necessary: "000", "001", "013", "099", "100"
ofn-export-layers is a close cousin, it exports all the layers of the image as separate files, using the same flexible way of naming the output files.
Posts: 7,131
Threads: 155
Joined: Oct 2016
Reputation:
1,003
Operating system(s):
Gimp version: 2.10
It is a bit 'picky' about image size http://i.imgur.com/V3hnbHf.jpg
Cropping image and taking a stage further. Made the tiles. Now Reassemble
Re-assembling with some tool, Hugin, NIP2 or such as (heaven forbid ) arrange-layers-0.2.py http://i.imgur.com/72UnCLJ.jpg
Top left corner is Tile 01-01 - correct. Then the default numbering is column-wise. I find it more usual to order row-wise, that might just be me but if the Format includes a simple drop-down row-wise/column wise as well as editable that might save a few mistakes editing the values.
Posts: 6,338
Threads: 272
Joined: Oct 2016
Reputation:
562
Operating system(s):
Gimp version: 2.10
(08-10-2017, 08:25 AM)rich2005 Wrote: It is a bit 'picky' about image size http://i.imgur.com/V3hnbHf.jpg
Cropping image and taking a stage further. Made the tiles. Now Reassemble
Re-assembling with some tool, Hugin, NIP2 or such as (heaven forbid ) arrange-layers-0.2.py http://i.imgur.com/72UnCLJ.jpg
Top left corner is Tile 01-01 - correct. Then the default numbering is column-wise. I find it more usual to order row-wise, that might just be me but if the Format includes a simple drop-down row-wise/column wise as well as editable that might save a few mistakes editing the values.
1) Yes. But if I have to deal with partial tiles, this gets messy:
- Do I make partial tiles or ignore them?
- Where do I take them? Top/Bottom? Left/Right?
- Or do I center and shave off the margins?
To cover all this the dialog and logic gets very complicated. While the user can just crop or extend the layer so that the script will cut the right tiles. Then there is also the option to ask for tile sizes instead of tile count...
2) That's the whole point of the name format string. If you use "{row0}-[column0} your tiles are naturally sorted by row, but you can also use "{column0}-{row0} to get names sorted on columns. I have also added two formatting variables tileRC and tileCR which are just sequence numbers (so if you produce 10x20 tiles, then will go 1..200), one with row-first and one with column-first (and of course with 0-based and 1-based versions).
Posts: 6,338
Threads: 272
Joined: Oct 2016
Reputation:
562
Operating system(s):
Gimp version: 2.10
New version uploaded, with doc.
Posts: 7,131
Threads: 155
Joined: Oct 2016
Reputation:
1,003
Operating system(s):
Gimp version: 2.10
(08-10-2017, 01:27 PM)Ofnuts Wrote: New version uploaded, with doc.
Yes, tried it, works nicely. Doc (html) covers everything.
Posts: 6,338
Threads: 272
Joined: Oct 2016
Reputation:
562
Operating system(s):
Gimp version: 2.10
(08-10-2017, 05:02 PM)rich2005 Wrote: (08-10-2017, 01:27 PM)Ofnuts Wrote: New version uploaded, with doc.
Yes, tried it, works nicely. Doc (html) covers everything.
Thanks for the checks. There are no good programmers without good testers
Posts: 4
Threads: 1
Joined: Aug 2017
Reputation:
0
Operating system(s):
(08-09-2017, 09:15 PM)Ofnuts Wrote: The place to discuss ofn-tiles (still fairly experimental as this thread is started).
ofn-tiles is available here.
So, you have a layer, ofn-tiles will cut it into X by Y tiles (you give the number of tiles of each direction), and save each tile in a
specified directory. ofn-tiles in accessed via Layer>Save as tiles.
Name of the tiles: the file names of the tiles are obtained by inserting the row and column number of the tile (or its sequence number) in a string that your provide. The place where these numbers are inserted are indicated by names in braces:
- row0, row1 is the row number of the tile. When using "row0" the first row is 0 and when using "row1" the first row is 1.
- column0, column1 is the column number of the tile. Ending in 0,1 is same as above
- tileRC0,tileRC1, tileCR0,tileCR1, is the tile number. Ending in 0,1 is same as above. The *CR has the rows scanned first so tiles 1, 2, 3 are in the first column while the *RC has the columns scanned first, and tiles 1,2,3 are in the first row.
- the string is the complete name of the file and should have an image format extension (png, gif, jpg...) since it will be used by Gimp to determine how to save the file. The defaults settings for the file type are used.
- the name pattern is actually a Python format, so modifiers can be used. For instance {row0:03d} will insert the row number on at least three digits, with zeroes added to the left if necessary: "000", "001", "013", "099", "100"
I have ofn-tile in /.gimp-2.8/plug-ins,. How do I run it please?
Posts: 6,338
Threads: 272
Joined: Oct 2016
Reputation:
562
Operating system(s):
Gimp version: 2.10
(08-11-2017, 03:10 PM)RayArdia Wrote: (08-09-2017, 09:15 PM)Ofnuts Wrote: The place to discuss ofn-tiles (still fairly experimental as this thread is started).
ofn-tiles is available here.
So, you have a layer, ofn-tiles will cut it into X by Y tiles (you give the number of tiles of each direction), and save each tile in a
specified directory. ofn-tiles in accessed via Layer>Save as tiles.
Name of the tiles: the file names of the tiles are obtained by inserting the row and column number of the tile (or its sequence number) in a string that your provide. The place where these numbers are inserted are indicated by names in braces:
- row0, row1 is the row number of the tile. When using "row0" the first row is 0 and when using "row1" the first row is 1.
- column0, column1 is the column number of the tile. Ending in 0,1 is same as above
- tileRC0,tileRC1, tileCR0,tileCR1, is the tile number. Ending in 0,1 is same as above. The *CR has the rows scanned first so tiles 1, 2, 3 are in the first column while the *RC has the columns scanned first, and tiles 1,2,3 are in the first row.
- the string is the complete name of the file and should have an image format extension (png, gif, jpg...) since it will be used by Gimp to determine how to save the file. The defaults settings for the file type are used.
- the name pattern is actually a Python format, so modifiers can be used. For instance {row0:03d} will insert the row number on at least three digits, with zeroes added to the left if necessary: "000", "001", "013", "099", "100"
I have ofn-tile in /.gimp-2.8/plug-ins,. How do I run it please?
The ZIP you downloaded includes HTML doc that explains everything (normally).
Posts: 7,131
Threads: 155
Joined: Oct 2016
Reputation:
1,003
Operating system(s):
Gimp version: 2.10
08-11-2017, 06:33 PM
(This post was last modified: 08-11-2017, 06:34 PM by rich2005.)
Quote: have ofn-tile in /.gimp-2.8/plug-ins,. How do I run it please?
Bottom of the Layer menu Save-as-Tiles make sure the image is in multiples of tile size. Try with the defaults first. Look at the help for more info.
Mosaics, especially large mosaics is a subject I had an interest in, so a video demo (is quick ) with the first minute, splitting up an image using Ofnuts ofn-tiles plugin.
https://youtu.be/EOy1L0EZ9vw
Stop there if all you need is a stack of numbered tiles. The rest, 5 minutes or so, is putting them back together.
Lots of ways to do this, many probably easier. For very large graphics you need NIP2 but using Ofnuts arrange-layers-0.2.py it is the same concept but on a small scale. Join tiles into rows, join rows to complete.
Posts: 6,338
Threads: 272
Joined: Oct 2016
Reputation:
562
Operating system(s):
Gimp version: 2.10
08-21-2017, 07:12 PM
(This post was last modified: 09-01-2017, 07:55 PM by Ofnuts.)
Updated the script, the changes are:
- can now also load tiles in a new image (for most reasonable naming schemes, will even guess number of rows and columns)
- script no longer deals with layers, it now deals with the whole image (menu entries now in File>Open and File>Export)
- ability to specify width and height (as an alternative to columns and rows)
- some more format variables
Enjoy.
|