在我的 Ubuntu 19.10 中尝试转换.jpg
为.pdf
:
转换结果为:
joso@joso-Aspire-ES1-433:~$ convert ‘/home/joso/Desktop/Marticeva etaziranje/IMG_20200104_102541.jpg’ output.pdf
convert: no decode delegate for this image format `JPG’ @ error/constitute.c/ReadImage/562.
convert: no images defined `output.pdf’ @ error/convert.c/ConvertImageCommand/3273.
我可以打开 jpg 文件。在终端中:
joso@joso-Aspire-ES1-433:~$ file /home/joso/Desktop/Marticeva\ etaziranje/IMG_20200104_102541.jpg
/home/joso/Desktop/Marticeva etaziranje/IMG_20200104_102541.jpg: JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=10, manufacturer=HUAWEI, model=ATU-L21, xresolution=150, yresolution=158, resolutionunit=2, software=ATU-L21-user 8.0.0 HUAWEIATU-L21 156(C432) release-keys, datetime=2020:01:04 10:25:41, GPS-Data], baseline, precision 8, 3120x4160, components 3
joso@joso-Aspire-ES1-433:~$
使用命令:
joso@joso-Aspire-ES1-433:~$ cp /home/joso/Desktop/Marticeva\ etaziranje/IMG_20200104_102541.jpg foo.jpg; convert foo.jpg foo.pdf
convert: no decode delegate for this image format JPG' @ error/constitute.c/ReadImage/562.
convert: no images definedfoo.pdf' @ error/convert.c/ConvertImageCommand/3273.
joso@joso-Aspire-ES1-433:~$
还是一样,没有成功。
我尝试了另外两个文件:
joso@joso-Aspire-ES1-433:~$ convert '/home/joso/Pictures/IMG_20191214_120216.jpg' output.pdf
convert: no decode delegate for this image format `JPG' @ error/constitute.c/ReadImage/562.
convert: no images defined `output.pdf' @ error/convert.c/ConvertImageCommand/3273.
joso@joso-Aspire-ES1-433:~$ convert '/home/joso/Pictures/John Selman2.jpeg' output.pdf
convert: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/562.
convert: no images defined `output.pdf' @ error/convert.c/ConvertImageCommand/3273.
joso@joso-Aspire-ES1-433:~$ convert /home/joso/Pictures/IMG_20191214_120216.jpg output.pdf
convert: no decode delegate for this image format `JPG' @ error/constitute.c/ReadImage/562.
convert: no images defined `output.pdf' @ error/convert.c/ConvertImageCommand/3273.
joso@joso-Aspire-ES1-433:~$
joso@joso-Aspire-ES1-433:~$ convert -compress jpeg /home/joso/Pictures/IMG_20191214_120216.jpg /home/joso/Pictures/output.pdf convert: no decode delegate for this image format JPG' @ error/constitute.c/ReadImage/562. convert: no images defined/home/joso/Pictures/output.pdf' @ error/convert.c/ConvertImageCommand/3273.
我可以在图像查看器中打开该文件并file
报告它是一个正常的 jpg:
$ file /home/joso/Desktop/Marticeva\ etaziranje/IMG_20200104_102541.jpg
/home/joso/Desktop/Marticeva etaziranje/IMG_20200104_102541.jpg: JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=10, manufacturer=HUAWEI, model=ATU-L21, xresolution=150, yresolution=158, resolutionunit=2, software=ATU-L21-user 8.0.0 HUAWEIATU-L21 156(C432) release-keys, datetime=2020:01:04 10:25:41, GPS-Data], baseline, precision 8, 3120x4160, components 3
我也按照评论中的建议尝试了这个:
$ convert -compress jpeg /home/joso/Pictures/IMG_20191214_120216.jpg
/home/joso/Pictures/output.pdf convert: no decode delegate for this image format JPG' @ error/constitute.c/ReadImage/562. convert: no images defined/home/joso/Pictures/output.pdf' @ error/convert.c/ConvertImageCommand/3273.
我究竟做错了什么?
答案1
保持简单。使用 libre office draw(或 impress)打开您的 jpg 文件。在菜单“文件”(我想是英文)中打开后,使用“导出为 pdf”导出此文件
答案2
sudo apt-get install imagemagick
然后你使用类似这样的方法处理 WORKINGDIRECTORY 中的文件(cd /path/to/workingdirectory/
)
convert input.jpg output.pdf
如果它不起作用,就像你没有获得许可或某些事情,你必须更改配置文件以允许转换函数执行此操作。你通过 sain 来做到这一点sudo nano /etc/ImageMagick-6/policy.xml
,然后你去标记出这一行<policy domain="coder" rights="none" pattern="PDF" />
,也许还有 JPG 行。