Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ofn-tiles & ofn-export-layers
#1
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.
Reply
#2
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 Wink ) 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.
Reply
#3
(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 Wink ) 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).
Reply
#4
New version uploaded, with doc.
Reply
#5
(08-10-2017, 01:27 PM)Ofnuts Wrote: New version uploaded, with doc.

Yes, tried it, works nicely. Doc (html) covers everything.
Reply
#6
(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 Smile
Reply
#7
(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?
Reply
#8
(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).
Reply
#9
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.
Reply
#10
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.
Reply


Forum Jump: