I'm trying to convert thousands of jpg images into 1 big PDF. Each image is a page from a book. I tried using the following command:

convert * out.pdf

But I'd get this error after maybe 150 images:

convert-im6.q16: DistributedPixelCache '' @ error/distribute-cache.c/ConnectPixelCacheServer/244. 
convert-im6.q16: cache resources exhausted `0-23/3_014.jpg' @ error/cache.c/OpenPixelCache/3984. ... 
convert-im6.q16: too many exceptions (exception processing suspended).

And yes, I changed resource limit in the policy.xml file for imagemagick to 8GiB. I have a decent laptop. 8GB RAM, 2.4hz x 4, 2GB GPU

There are about 3000 images, a total of 1GB

Is there another way?


Don't know if this will work, but you might try a two-step procedure, as follows.

First, separately convert each jpg image into its own pdf,

convert image1.jpg image1.pdf
convert image2.jpg image2.pdf

Then use pdfjam (man pdfjam for info) to collect all the images into a single pdf,

pdfjam image*.pdf --outfile allimages.pdf

And see http://go.warwick.ac.uk/pdfjam (as suggested on the manpage) for lots more --switches, etc.


The method most low on resources that I have found is to open images in an image viewer/browser (gThumb, Pix, Gwenview, Shotwell) and then print them to file - that is to pdf.

More details - with images - here: https://unix.stackexchange.com/a/555535/341192. Images can also be re-aranged in this way before "printing" to pdf.

A rather light method (compared to other CLI ones, but maybe not to the above I mentioned) is this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.