Merge multiple jpg into single pdf in Linux

后端 未结 6 1946
南旧
南旧 2021-01-30 02:25

I used the following command to convert and merge all the jpg files in a directory to a single pdf file.

convert *.jpg file.pdf

Th

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-30 02:50

    All of the above answers failed for me, when I wanted to merge many high-resolution jpeg images (from a scanned book).

    Imagemagick tried to load all files into RAM, I therefore used the following two-step approach:

    find -iname "*.JPG" | xargs -I'{}' convert {} {}.pdf
    pdfunite *.pdf merged_file.pdf
    

    Note that with this approach, you can also use GNU parallel to speed up the conversion:

    find -iname "*.JPG" | parallel -I'{}' convert {} {}.pdf
    

提交回复
热议问题