File:Create Stitch Script.ods
English: Helper to harvest map data from e.g. http://www.e-rara.ch/zut/content/zoom/6186201
The map is made from tiles, in this example 512 by 512 pixels each. The contributed spreadsheet (made with LibreOffice Calc) helps to create a script that downloads each tile (by means of wget) and stitches all of them together (by means of jpegtran). Note that in order to use the script, wget and a version of jpegtran with droppatch (rf. ) must be installed; this is typically not the case when using an Windows machine in out of the box state. Regarding the droppatch, even on Linux machines one has to take care that the installed version of jpegtran has got it.
<A more detailed description with examples, more from user’s point of view, but only in german can be found at :de:Benutzer:Pemu/Stitch-Script-Synthesizer.>
By using your browser, zoom into map upto desired (that probably means highest) zoom level, go to top rightmost tile, determine its url (e. g. by using "view this image alone" from the context menu). Despite the numbering order in the above example, most sites numbers tiles in reverse order, so, in these cases, look at the bottom righmost one. Maybe use other means to examine the urls of the tiles, e. g. Firefox’ developer tools or by using browser Chromium, opening context menu and use Inspect to examine the Sources in the just opened view. Determine column and row number of tiles, e.g from the remaning part of top righmost tile’s url or just by try and error (displaying error messages or empty tiles when entered in browser’s url field).
Split this url into two parts – the base (e. g. everything except the file name and the bottommost directory name, both consisting of numbers resembling row resp. column) and the remainder. Put the base part (including trailing slash or the like) into the cell B3 in the second line of the spreadsheet. Take determined column and row number and update cells below for no. of columns resp. rows (B4/B5). (Due to using the top-right tile’s url their values representing the resp. maximum values – in other words, the number of columns and rows minus one.) Often, rightmost and bottom tiles are smaller in size to yield a final size that isn’t a mutliple of remaining tiles’ size. To accomplish this, fill the appropriate values in cells B6 and B7; if it happens to be the same as the size of remaining tiles, just fill in the same numbers as in cells (B11 and B12). Note that currently there is no support, should the top line of tiles be smaller than the remaining ones. If necessary, adjust values for pixel width and height of each tile (cells B11/B12). Note: Putting the complete url in cell B1 has no effect except serving documentary purposes.
Depending on the fashion the website numbers the tiles adjust the multiplier, suffix and seperator (B13…B16). Insert a boolean value in B19: True, if tile numbering is from bottom to top like in a cartesian plane; false when tiles are numbered from top to bottom like in a table.
Adjust the names for commands for deleting and renaming (B28/B29) according to your OS or environment. (Linux typically "rm" and "mv", MS typically "del" and "ren".) Take also care if there should be an output redirection symbol (">") before the destination name of jpegtran and adjust B25 and B27 accordingly. (Linux versions seems to use std-out and therefore need ">", while Windows versions seems to handle file output by itself, so the ">" must be omitted)
Now select a rectangular set of cells, beginning with B31 as the top-left corner with the necessary width and height corresponding to the no. of rows and columns. The cells in column A and row 30 are coloured green to indicate the proper set of cells. Note that the coloured cells itself don’t belong to the proper set of cells. (In the given example the bottom right corner of selection is cell T40.) Copy and paste the content into an empty text file. Tab characters don’t bother. Save and execute the text file as batch file. This means that it must be named with extension of .bat or made executable, depending on your OS. Note that the cells easily appears to be empty (except for a small arrowhead to indicate they aren’t really) when sized small due to their (important) trailing newline.
After running, the file "ziel.jpg" (if not changed by means of B22) should contain the whole map.
If there are not enough cells in the rectangular set, it is easy to extend them. Note that the top row of cells is special; its commands will create a grey canvas of appropriate size, where the remaining cell’s commands will drop their tiles upon. The remaining cells are virtually equal and can be extended by selecting and using the small square in the corner of the selection to extend, resulting in copying the contents and adjusting the references to other cells. In addition, take care that in row 30 and in column A, there are continous numbers in the relevant ranges; this is easily done as well by Calc’s small-square-tool.
The commands in cell B31 download the top left tile and pushes it to the final size (by means of a "side effect" of jpegtran’s crop option). The intermediate image contains the tile in the top left corner and a grey area at the remainder. The commands in the remaining cells download each a particular tile and replace some of the grey in the intermediate image by it (by means of jpegtran’s drop option). Note that currently the top-left tile will be download twice and dropped upon itself; this is accepted in order to keep all remaining tiles equal. Former versions of this spreadsheet had no distinct cell to blast the top-left tile to final size, but instead handled it "in set". This was annoying when using the small-square-tool, because one always had to take care of the "special" top-left cell in the rectangular set.
|Date||15 November 2017|
File:Create Stitch Script V2.ods Experimental Version to better support sites with TileGroup folders. Beware! Contains really cobbled together bash code and demonstrates performance problems of Calc.
Despite technically not true, there may nevertheless be some reasons to file it under Category:Panorama stitching project files.
Click on a date/time to view the file as it appeared at that time.
|current||23:58, 15 November 2017||(153 KB)||Pemu||Added qdl.qa|
|00:23, 15 September 2017||(151 KB)||Pemu||Added wdl.org. Added green background at numbering cells that should help to mark correct cells in order to copy & paste the final batch file.|
|02:18, 9 June 2017||(153 KB)||Pemu||jpegtran can't create grey images from scratch, hence give it some kind of seed to create the big canvas in the beginning. Terefore, first tile will be downloaded twice.|
|02:00, 9 June 2017||(153 KB)||Pemu||*Included an option to limit final size in case of smaller edge tiles to prevent grey residuals in final image. Not tested, just a concept demo. *Create grey canvas beforehand downloading first tile, in order to prevent top left cell from being special...|
|13:43, 4 June 2017||(141 KB)||Pemu||Added some translations|
|11:45, 4 June 2017||(134 KB)||Pemu||Changes made to use with maps.nls.uk|
|11:44, 1 February 2016||(23 KB)||Pemu||User created page with UploadWizard|
- You cannot overwrite this file.