Quick convert jpg to PDF one-liner
OS: Windows
Required software:
https://www.ghostscript.com/download.html
Spent a few hours before syntax was correct, so I felt I should share this.
gswin64c -dORIENT1=false -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=C:\Users\username\Desktop\somepdffile.pdf -c "<</Orientation 3>> setpagedevice" -f "C:\Program Files\gs\gs9.19\lib\viewjpeg.ps" -c "(C:\\Users\\username\\Desktop\\somejpgfile.JPG) << /PageSize 2 index viewJPEGgetsize 2 array astore >> setpagedevice viewJPEG"
So, after installing GhostScript, open command prompt in C:\Program Files\gs\gs%version_number%\bin
The one-liner above converts jpg file to pdf with auto-size and rotation 90 degrees clockwise.
Can be modified to handle multiple jpg by duplicating string “(C:\Users\username\Desktop\somejpgfile.JPG) << /PageSize 2 index viewJPEGgetsize 2 array astore >> setpagedevice viewJPEG”