I use Ghostscript to convert JPEG to PDF:
gs -sDEVICE=pdfwrite -o d.pdf viewjpeg.ps -c "(Imgp3826.Jpeg) viewJPEG showpage
This creates PDF with default page size and image, located on left bottom corner. I need to modify script to create page with correct dimensions.
in this note: https://stackoverflow.com/a/6508854/907576
they do this using ImageMagick, but I can't use it - I can use Ghostscript only.
Is is possible to get width-height values from viewjpeg.ps
and set it to page size?
I see in viewjpeg.ps
:
/height NextByte 8 bitshift NextByte add def
/width NextByte 8 bitshift NextByte add def
Looks like they use JPEG headers to read this info.
Can I then reuse it for <</PageSize [${dimension}]>>
?