In case anyone is interested, here is what I found after playing with it for a while. The different image formats give very different speed results.
* PNG is very slow, but makes the smallest files
* TIFF uncompressed is fast, but makes huge files
* TIFF compressed slows down proportionally to the compression
* JPEG is fast and makes small files, but of course not exactly identical
For my needs, I settled on JPEG with -quality 100%. For perfect quality, select the TIFF compromise which suits you between speed and file size.
Some statistics produced with this code, which I ran several times ( and averaged the results ):
Code: Select all
time for i in `seq 1 100`; do \
convert -background "#666666" -fill "#99CCFF" -font "$font" \
-size 1920x1080 -gravity center -pointsize $((1080/8)) \
label:"image $i" \
png:- > /dev/null; \
done
* 100 PNG : 41 sec. (35K files)
* 100 JPEG : 9 sec. (62K) adding "-quality 100%"
* 100 TIFF uncompressed : 8 sec. (but 16.6 MB!)
* 100 TIFF ZIP : 20 sec. (40K) adding "-compress zip"
* 100 TIFF LZW : 16 sec. (255K) adding "-compress lzw"
* 100 TIFF RLE : 13 sec. (8 MB) adding "-compress rle"
I also tried to reduce the depth of the TIFF with "-depth 8", but it almost tripled the time, while only reducing the huge size by half. And "-depth 16", which is the default, actually triggered some extra calcuations, increasing the time by 50% for no reason. So avoid "-depth" if speed matters.
Apart from that, I also tried snibgo's suggestion of stuffing all the iterations into a single convert call. It did gain some more speed (5-20%) for the faster converts, but it makes the code much more complex and hard to read a week later. And on the slow .png convert, it made hardly a difference. Anyway, in case someone wants to try this version, this is what I tested:
Code: Select all
cat <<END1 > run
convert -background "#666666" -fill "#99CCFF" -font "$font" \\
-size 1920x1080 -gravity center -pointsize $((1080/8)) \\
END1
for i in `seq 1 100`; do cat <<END2 >> run
label:"image $i" +write "$(printf test-y-%06d.png $i)" +delete \\
END2
done
echo "null: null:" >> run
chmod +x run
time ./run