4

in my Ubuntu 19.10 when trying to convert .jpg to .pdf :

convert gives :

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.

I can open jpg file. In terminal:

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:~$

using command :

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:~$

still the same, no success.

I tried with 2 other files:

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.

I can open the file in an image viewer and file reports it's a normal 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

I also tried this as suggested in the comments:

$ 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.

What am I doing wrong?

3
  • Make the last one probably echo $MAGICK_HOME - for me that variable is not set. Check what formats are supported: identify -list format | grep JPG. I expect an installation issue here.
    – vanadium
    Jan 6, 2020 at 12:57
  • 1
    I solved this problem by reinstalling fresh Ubuntu 19.10 from live USB, and than installing ImageMagic-6 . After that I changed in etc/ImageMagic-6/policy.xml by adding line: <policy domain="coder" rights="read | write" pattern="PDF" /> and changing to: <policy domain="coder" rights="read | write" pattern="PDF" /> now it works !
    – Kirby-1989
    Jan 7, 2020 at 8:10
  • @user3140225 reinstalling Ubuntu 19.10 obviously is not a valid solution to this problem! Perhaps only changing the policy line would do the trick? Anyway, since a reinstall has been done, there is no use to investigate this problem further.
    – vanadium
    Jan 7, 2020 at 10:00

2 Answers 2

6

Keep it simple. Open your jpg file with libre office draw (or impress). Once open in the menu "file" (i suppose in English) export this file with " export as pdf")

4
  • 2
    While this might work for a single file, it is obviously not practical for batch processing. Nor does it address the real issue of why convert is failing. The OP's command should work, there's something strange going on.
    – terdon
    Jan 6, 2020 at 19:24
  • Not an appropriate answer: question is on basic core functionality of the "convert" utility. And yes, it becomes quite less efficient if yo need to handle 100 files in a folder. After all, it is a computer we use, and we want the computer to do the tedious work.
    – vanadium
    Jan 7, 2020 at 9:58
  • I cannot read that it handles over more than one jpg. The question is not clear. Jan 7, 2020 at 17:25
  • You can use Master pdf editor (for free in Linux) :Create PDF documents from scanned documents / existing files . Download: "linuxuprising.com/2019/04/…" Jan 7, 2020 at 17:35
1
sudo apt-get install imagemagick

then you use somethin like this with the files in WORKINGDIRECTORY (cd /path/to/workingdirectory/)

convert input.jpg output.pdf

if it aint working like u aint got permission or somethin u gotta change the config file to allow that convert function to do that. you do that by sain sudo nano /etc/ImageMagick-6/policy.xml and then you go to hashtag out this line <policy domain="coder" rights="none" pattern="PDF" /> and maybe the JPG line too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .