I’m trying to set up a workflow that will create a PDF from a bunch of individual jpeg files. The files are named like this:
00000001.jpg
00000002.jpg
00000003.jpg
00000004.jpg
00000005.jpg
When I drag these to the “read individual files” action, I can see in the Inspector that Retrobatch has read them in descending order. (0000005.jpg, 0000004,jpg, etc)
I’ve tried to figure out how to use a Sort node to correct the order, but I’m stumped. How can I get these to feed into the PDF Maker node in the correct (ascending) order?
There’s no node that’ll change the order images are processed after they have been added to the Files node.
However, if they are in a single folder, then you can drag and drop that folder into the canvas and use the Sort By: option to change the order they are read. Does that work for you?
Thanks! Hmm, that helps. Is there a way to pass a folder and sort order from a script or command line? I have a lot of folders that need processing like this.
(Background: I have very old magazine scans, where each page was scanned as a separate jpeg file. I’m trying to compile each issue into one PDF, which I’ll later OCR for search ability. Retrobatch’s PDF Maker does a nice job of the assembly, but there are many issues that need processing.)
You can pass the arguments to Retrobatch from the shell, and it’ll keep the order you pass them in for processing. If you give a folder, it’ll sort everything in that folder before adding them.
Thank you, Gus. For posterity, here’s where I landed:
ls -1r | xargs /Applications/Retrobatch.app/Contents/MacOS/Retrobatch --workflow ~/Desktop/jpeg2pdf.retrobatch --output ~/Desktop/temp/
Given the filenames I provided earlier in this thread, to get the pages to come out of PDF Maker in ascending order the -r argument was needed for ls.This is executed with the current directory set to the folder containing the jpeg files to convert.