Answer the question
In order to leave comments, you need to log in
How to make ImageMagick take file order correctly?
Hello. There are .png files, you need to convert them to pdf with compression. I do it like this:
convert -quality 75 *.png result.jpg && convert *.jpg result.pdf && rm *.jpg
result-0, result-1 ... result-9, result-10>
Answer the question
In order to leave comments, you need to log in
wincmd.ru/multirename.php is speeding up the crutch
www.imagemagick.org/Usage/files and these are the rules:
use wildcard not "*", but ? - one character
i.e. first shove everything with one, then with two, etc.
but safer - rename
#!/bin/bash
mkdir converted
for file in *.png;
do
convert -quality 70 $file 'converted/'result.jpg
mv 'converted/'result.jpg 'converted/'$file'_result'.jpg
echo "Converted..."
done
echo "Done"
Oh. You read man there. What can be thrown out of PNG and in what "quality" to get the output.
But my answer to the question is simple: use xargs.
Well, or we do it corny, for example, ls *.png | convert ...
But there is nothing better than xargs in this case.
example input_0.png input_1.png input_2.png ...input_10.png
result result_0.png result_1.png result_2.png ...result_10.png
or if only selected files are needed
but better
then the result is result_ 00 .png result_ 01 .png result_ 02 .png ...result_10.png which is much more convenient when working with files
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question