Generation of thumbnails in WXP

Share your Inkscape tricks and tutorials here.
rosros
Posts: 68
Joined: Fri Aug 24, 2007 12:54 am

Generation of thumbnails in WXP

Postby rosros » Sun Oct 16, 2011 2:23 am

The following code can be cut and pasted into a Windows batch file for generating png thumbnails of all the svg files in a directory
and its subdirectories. A thumbnail is not generated if the svg file has not changed (after the previous generation).

In order to use this:
1. Create a new directory and a subdirectory;
2. Save a few svg files in them;
3. Cut & paste the code into a text file (use "notepad"), set inkscape.exe path according to the actual location, then save the
file as (e.g.) "generate.bat";
4. Create a small text file containing only the letter "F" and a carriage return, save it as "f.txt" in the same directory;
5. Double click on "generate.bat" in Explorer to launch the program;
6. Check that the result is as expected.

Note: there is some WXP console feedback, if you do not need it just erase the lines "echo/|set /p =." and "echo %%i".

Code: Select all

echo off
for /R %%i in (*.svg) do (
xcopy/M/Y/Q %%i "%%~di%%~pitemp.svg" < f.txt > nul
echo/|set /p =.
if exist  "%%~di%%~pitemp.svg" (
echo %%i
E:\DTP\Inkscape\inkscape.exe "%%~di%%~pitemp.svg" --export-png="%%~di%%~pi%%~ni.png" -w 200
erase  "%%~di%%~pitemp.svg"
)
)


HTH

Return to “Tricks & Tutorials”