Create ImageMagick Linux script -


i have imagemagick convert command use shell , create linux exec run it, don't have run this.

i converting pdf file jpeg files, , use: convert -density 300 *.pdf -alpha off -scale 1500x2000 -quality 70 jpegfiles.jpg

what linux exec file run above convert , instead of jpegfiles, have actual pdf filename. of course, every page jpeg file have filename-0.jpg, filename-1.jpg, filename-2.jpg, etc.

i using ubuntu. thank you.

save in file , place in dir $home/.bin
eg. $home/.bin/pdf2jpg

for file in "$@";     convert -density 300 "$file" -alpha off -scale 1500x2000 -quality 70 "${file%.*}-%d.jpg" done 

make executable

chmod +x $home/.bin/pdf2jpg 

and add dir path variable

echo "path=$path:$home/.bin" >> $home/.bash_profile    # assuming use bash 

create dir named pdf along -images suffix , place files in there

for file in "$@";     dir="${file%.*}-images"     mkdir -p "$dir"     convert -density 300 "$file" -alpha off -scale 1500x2000 -quality 70 "$dir/${file%.*}-%d.jpg" done 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -