0-padding numbers in filename when using fx calculation
Posted: 2016-12-21T04:10:00-07:00
I'm splitting a large image into tiles, with the X, Y coord of each tile in the tile filenames:
This works fine but I'd like to 0-pad the filenames so that instead of "tile_3_1.png" I get "tile-03_01.png".
Can anyone give me a hint how to do this?
My best effort so far is:
But this doesn't work, I get filenames like"tile_3_%[f1.png".
Code: Select all
convert "livingroom0-2560x1280.jpg" -crop 512x512 -set filename:tile "%[fx:page.x/512]_%[fx:page.y/512]" \
+repage "tile_%[filename:tile].png"
Can anyone give me a hint how to do this?
My best effort so far is:
Code: Select all
convert "livingroom0-2560x1280.jpg" -crop 512x512 -set filename:yLoc "%[fx:page.y/512]" \
-set filename:xLoc "%[fx:page.x/512]" +repage "tile_%[filename:xLoc]_%[filename:yLoc].png"