On Ubuntu 21.04. Do sudo apt install img2pdf, then in a folder with a few jpg files, run
img2pdf *.jpg -o out.pdf
yields
ERROR:root:error: not a TIFF file (header b'http://n' not valid)
Install does need root access.
On Ubuntu 21.04. Do `sudo apt install img2pdf`, then in a folder with a few jpg files, run
`img2pdf *.jpg -o out.pdf`
yields
`ERROR:root:error: not a TIFF file (header b'http://n' not valid)`
Install does need root access.
Hi,
can you narrow this down to the one specific file in your folder that triggers this problem? Once you have the file, you can post it here and I can have a look at it and tell you why img2pdf throws this error.
Thanks!
Hi,
can you narrow this down to the one specific file in your folder that triggers this problem? Once you have the file, you can post it here and I can have a look at it and tell you why img2pdf throws this error.
Thanks!
Not trying to be awkward, but unfortunately I cannot share the images. I tried cropping the private data out of them with convert but the resulting file does not retain the problem (i.e. img2pdf works fine on it). So that's not much help.
I extracted the file info though, and removed identifying elements, in case that helps. They are from an iPhone 12:
It is of course completely understandable if you cannot share a private photo.
Unfortunately, there is also nothing I can do without a file that shows the problem you are facing.
Maybe you can use your phone to take a new photo without anything private in it that triggers the issue you saw?
It is of course completely understandable if you cannot share a private photo.
Unfortunately, there is also nothing I can do without a file that shows the problem you are facing.
Maybe you can use your phone to take a new photo without anything private in it that triggers the issue you saw?
@josch it's not my phone - it's a scan of a document sent to me to process. If I come across it again and can share, I certainly will. In the meantime, maybe someone here who has an iPhone 12 could see if they have the problem with its output?
@josch it's not my phone - it's a scan of a document sent to me to process. If I come across it again and can share, I certainly will. In the meantime, maybe someone here who has an iPhone 12 could see if they have the problem with its output?
If it's a scan, then it should not be related to your phone, no?
You could ask the person from whom you got the scan to scan an empty page for you.
Maybe you can also find out which scanner they were using.
If it's a scan, then it should not be related to your phone, no?
You could ask the person from whom you got the scan to scan an empty page for you.
Maybe you can also find out which scanner they were using.
Ah, thanks @josch. That never occurred to me because of the situation! But I asked, and the individual kindly sent on an image that issues the same problem as noted above. Hope it helps!
Ah, thanks @josch. That never occurred to me because of the situation! But I asked, and the individual kindly sent on an image that issues the same problem as noted above. Hope it helps!
If it's a scan, then it should not be related to your phone, no?
Maybe you can also find out which scanner they were using.
The way I understood @ccaprani, the document was "scanned" (photographed) with an iPhone 12 and sent to him by another person, right? So it hasn't got anything to do with scanner hardware.
> If it's a scan, then it should not be related to your phone, no?
> Maybe you can also find out which scanner they were using.
The way I understood @ccaprani, the document was "scanned" (photographed) with an iPhone 12 and sent to him by another person, right? So it hasn't got anything to do with scanner hardware.
I just tried to convert the image you uploaded, and with a warning I get an ouptut pdf, but the result is really weird: The first page is correct, but there's an inadvertent second page with the image rotated, much bigger and darker.
This is the warning:
/home/mara/.local/lib/python3.8/site-packages/PIL/JpegImagePlugin.py:811: UserWarning: Image appears to be a malformed MPO file, it will be interpreted as a base JPEG file
warnings.warn(
(img2pdf 0.4.1, Pillow 8.3.1)
I just tried to convert the image you uploaded, and with a warning I get an ouptut pdf, but the result is really weird: The first page is correct, but there's an inadvertent second page with the image rotated, much bigger and darker.
This is the warning:
```
/home/mara/.local/lib/python3.8/site-packages/PIL/JpegImagePlugin.py:811: UserWarning: Image appears to be a malformed MPO file, it will be interpreted as a base JPEG file
warnings.warn(
```
(img2pdf 0.4.1, Pillow 8.3.1)
I'm making the same obseravation on my system as @mara0004. I'm not getting the not a TIFF file error but the MPO warning.
If this file also produces the not a TIFF file error on your system, then you should probably next share the versions of the libraries you have installed.
Thanks!
I'm making the same obseravation on my system as @mara0004. I'm not getting the `not a TIFF file` error but the `MPO` warning.
If this file also produces the `not a TIFF file` error on your system, then you should probably next share the versions of the libraries you have installed.
Thanks!
Yes, confirmed this is the terminal response for this file: ERROR:root:error: not a TIFF file (header b'http://n' not valid)
Running img2pdf 0.4.0 installed via apt as above.
So I installed img2pdf (0.4.1) using pip, and executed:
and this works ok on my system (Ubuntu 21.094, with Pillow 8.3.1)
HI @josch and @mara0004,
Yes, confirmed this is the terminal response for this file:
```ERROR:root:error: not a TIFF file (header b'http://n' not valid)```
Running `img2pdf 0.4.0` installed via apt as above.
So I installed img2pdf (0.4.1) using pip, and executed:
```python
>>> with open("out.pdf","wb") as f:
... f.write(img2pdf.convert('image0.jpeg'))
```
and this works ok on my system (Ubuntu 21.094, with Pillow 8.3.1)
Ah indeed, yes, the image that you posted is a JPEG but it is also an MPO file and support for MPO JPEGs was added in d29c596fe7 which is part of img2pdf 0.4.1. Details can be found in #93.
So yeah, the img2pdf version in Ubuntu 21.04 doesn't support MPO JPEGs and it's not possible to identify the JPEG as an MPO from the identify output you posted, unfortunately.
Maybe you can approach the Ubuntu maintainers to apply d29c596fe7 to the package they ship?
Ah indeed, yes, the image that you posted is a JPEG but it is also an MPO file and support for MPO JPEGs was added in d29c596fe79e4bccd986b0f9e045bab3dbab02dd which is part of img2pdf 0.4.1. Details can be found in #93.
So yeah, the img2pdf version in Ubuntu 21.04 doesn't support MPO JPEGs and it's not possible to identify the JPEG as an MPO from the `identify` output you posted, unfortunately.
Maybe you can approach the Ubuntu maintainers to apply d29c596fe79e4bccd986b0f9e045bab3dbab02dd to the package they ship?
@josch Thanks for getting to the bottom of this. At least it's a 0.4.0 feature not a bug :p In any case, I guess you manage the version that gets added to the Ubuntu repo? I'm not sure how that works to get it updated to 0.4.1 for sudo apt install.
@josch Thanks for getting to the bottom of this. At least it's a 0.4.0 feature not a bug :p In any case, I guess you manage the version that gets added to the Ubuntu repo? I'm not sure how that works to get it updated to 0.4.1 for `sudo apt install`.
I guess you manage the version that gets added to the Ubuntu repo? I'm not sure how that works to get it updated to 0.4.1
You'd probably have to file a package bug report at launchpad.net. However, I think the chances for Ubuntu to update img2pdf are quite low, they usually refuse to update packages unless affected by a security issue.
> I guess you manage the version that gets added to the Ubuntu repo? I'm not sure how that works to get it updated to 0.4.1
You'd probably have to file a package bug report at launchpad.net. However, I think the chances for Ubuntu to update img2pdf are quite low, they usually refuse to update packages unless affected by a security issue.
No, I don't have anything to do with Ubuntu packaging except if you count that Ubuntu regularly pulls packages from Debian where I'm the maintainer. So the Ubuntu changelog lists me but I have no way to modify anything in Ubuntu. They just imported the package that I maintain in Debian.
No, I don't have anything to do with Ubuntu packaging except if you count that Ubuntu regularly pulls packages from Debian where I'm the maintainer. So the [Ubuntu changelog](http://changelogs.ubuntu.com/changelogs/pool/universe/i/img2pdf/img2pdf_0.4.0-1/changelog) lists me but I have no way to modify anything in Ubuntu. They just imported the package that I maintain in Debian.
On Ubuntu 21.04. Do
sudo apt install img2pdf
, then in a folder with a few jpg files, runimg2pdf *.jpg -o out.pdf
yields
ERROR:root:error: not a TIFF file (header b'http://n' not valid)
Install does need root access.
Hi,
can you narrow this down to the one specific file in your folder that triggers this problem? Once you have the file, you can post it here and I can have a look at it and tell you why img2pdf throws this error.
Thanks!
Hi @josch
Not trying to be awkward, but unfortunately I cannot share the images. I tried cropping the private data out of them with
convert
but the resulting file does not retain the problem (i.e.img2pdf
works fine on it). So that's not much help.I extracted the file info though, and removed identifying elements, in case that helps. They are from an iPhone 12:
It is of course completely understandable if you cannot share a private photo.
Unfortunately, there is also nothing I can do without a file that shows the problem you are facing.
Maybe you can use your phone to take a new photo without anything private in it that triggers the issue you saw?
@josch it's not my phone - it's a scan of a document sent to me to process. If I come across it again and can share, I certainly will. In the meantime, maybe someone here who has an iPhone 12 could see if they have the problem with its output?
If it's a scan, then it should not be related to your phone, no?
You could ask the person from whom you got the scan to scan an empty page for you.
Maybe you can also find out which scanner they were using.
Ah, thanks @josch. That never occurred to me because of the situation! But I asked, and the individual kindly sent on an image that issues the same problem as noted above. Hope it helps!
The way I understood @ccaprani, the document was "scanned" (photographed) with an iPhone 12 and sent to him by another person, right? So it hasn't got anything to do with scanner hardware.
I just tried to convert the image you uploaded, and with a warning I get an ouptut pdf, but the result is really weird: The first page is correct, but there's an inadvertent second page with the image rotated, much bigger and darker.
This is the warning:
(img2pdf 0.4.1, Pillow 8.3.1)
@ccaprani Can you confirm the behaviour I described above, or do you still get the TIFF error on this file?
I'm making the same obseravation on my system as @mara0004. I'm not getting the
not a TIFF file
error but theMPO
warning.If this file also produces the
not a TIFF file
error on your system, then you should probably next share the versions of the libraries you have installed.Thanks!
HI @josch and @mara0004,
Yes, confirmed this is the terminal response for this file:
ERROR:root:error: not a TIFF file (header b'http://n' not valid)
Running
img2pdf 0.4.0
installed via apt as above.So I installed img2pdf (0.4.1) using pip, and executed:
and this works ok on my system (Ubuntu 21.094, with Pillow 8.3.1)
Ah indeed, yes, the image that you posted is a JPEG but it is also an MPO file and support for MPO JPEGs was added in
d29c596fe7
which is part of img2pdf 0.4.1. Details can be found in #93.So yeah, the img2pdf version in Ubuntu 21.04 doesn't support MPO JPEGs and it's not possible to identify the JPEG as an MPO from the
identify
output you posted, unfortunately.Maybe you can approach the Ubuntu maintainers to apply
d29c596fe7
to the package they ship?@josch Thanks for getting to the bottom of this. At least it's a 0.4.0 feature not a bug :p In any case, I guess you manage the version that gets added to the Ubuntu repo? I'm not sure how that works to get it updated to 0.4.1 for
sudo apt install
.You'd probably have to file a package bug report at launchpad.net. However, I think the chances for Ubuntu to update img2pdf are quite low, they usually refuse to update packages unless affected by a security issue.
No, I don't have anything to do with Ubuntu packaging except if you count that Ubuntu regularly pulls packages from Debian where I'm the maintainer. So the Ubuntu changelog lists me but I have no way to modify anything in Ubuntu. They just imported the package that I maintain in Debian.