Scanned jpeg ExifOrientationError: Invalid rotation (0) #90

Closed
opened 3 years ago by josch · 0 comments
josch commented 3 years ago
Owner

By tester123123 on 2021-03-04T09:44:23.873Z

Describe the bug
Jpegs produced with Open Note Scanner cannot be converted with img2pdf and the process returns ExifOrientationError: Invalid rotation (0) as the error message.

To Reproduce

img2pdf DOC-20210303-205812.jpg  -o out.pdf -v

Log:

img2pdf DOC-20210303-205812.jpg  -o out.pdf -v
DEBUG:PIL.TiffImagePlugin:tag: ImageWidth (256) - type: long (4) - value: b'\x00\x00\x0b\xb8'
DEBUG:PIL.TiffImagePlugin:tag: ImageLength (257) - type: long (4) - value: b'\x00\x00\x0f\xa0'
DEBUG:PIL.TiffImagePlugin:tag: Software (305) - type: string (2) Tag Location: 46 - Data Location: 86 - value: <table: 52 bytes>
DEBUG:PIL.TiffImagePlugin:tag: ExifIFD (34665) - type: long (4) - value: b'\x00\x00\x00\x9e'
DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x00\x00'
DEBUG:PIL.TiffImagePlugin:tag: DateTime (306) - type: string (2) Tag Location: 82 - Data Location: 138 - value: b'2021:03:03 20:58:12\x00'
DEBUG:PIL.TiffImagePlugin:tag: DateTImeDigitized (36868) - type: string (2) Tag Location: 172 - Data Location: 200 - value: b'2021:03:03 20:58:12\x00'
DEBUG:PIL.TiffImagePlugin:tag: UserComment (37510) - type: string (2) Tag Location: 184 - Data Location: 220 - value: <table: 34 bytes>
DEBUG:PIL.TiffImagePlugin:tag: LightSource (37384) - type: long (4) - value: b'\x00\x00\x00\x00'
DEBUG:root:imgformat = JPEG
DEBUG:root:input dpi = 72 x 72
ERROR:root:error: Invalid rotation (0)
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/img2pdf.py", line 3629, in main
    convert(
  File "/usr/lib/python3.9/site-packages/img2pdf.py", line 2032, in convert
    ) in read_images(rawdata, kwargs["colorspace"], kwargs["first_frame_only"]):
  File "/usr/lib/python3.9/site-packages/img2pdf.py", line 1374, in read_images
    color, ndpi, imgwidthpx, imgheightpx, rotation, iccp = get_imgmetadata(
  File "/usr/lib/python3.9/site-packages/img2pdf.py", line 1224, in get_imgmetadata
    raise ExifOrientationError("Invalid rotation (%d)" % value)
img2pdf.ExifOrientationError: Invalid rotation (0)

Example file

scan.zip

Expected behavior
No error should happen.

System

  • OS: Archlinux
  • img2pdf version: img2pdf 0.4.0

By tester123123 on 2021-03-04T14:27:30.643Z


After a bit of research the app seems to write an invalid rotation value: https://github.com/allgood/OpenNoteScanner/issues/248


By tester123123 on 2021-03-04T14:27:30.778Z


Status changed to closed


By josch on 2021-03-04T16:50:28.964Z


That assessment is correct. You should file a bug against "Open Note Scanner". Thank you!

*By tester123123 on 2021-03-04T09:44:23.873Z* **Describe the bug** Jpegs produced with `Open Note Scanner` cannot be converted with `img2pdf` and the process returns `ExifOrientationError: Invalid rotation (0)` as the error message. **To Reproduce** ```bash img2pdf DOC-20210303-205812.jpg -o out.pdf -v ``` Log: ``` img2pdf DOC-20210303-205812.jpg -o out.pdf -v DEBUG:PIL.TiffImagePlugin:tag: ImageWidth (256) - type: long (4) - value: b'\x00\x00\x0b\xb8' DEBUG:PIL.TiffImagePlugin:tag: ImageLength (257) - type: long (4) - value: b'\x00\x00\x0f\xa0' DEBUG:PIL.TiffImagePlugin:tag: Software (305) - type: string (2) Tag Location: 46 - Data Location: 86 - value: <table: 52 bytes> DEBUG:PIL.TiffImagePlugin:tag: ExifIFD (34665) - type: long (4) - value: b'\x00\x00\x00\x9e' DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x00\x00' DEBUG:PIL.TiffImagePlugin:tag: DateTime (306) - type: string (2) Tag Location: 82 - Data Location: 138 - value: b'2021:03:03 20:58:12\x00' DEBUG:PIL.TiffImagePlugin:tag: DateTImeDigitized (36868) - type: string (2) Tag Location: 172 - Data Location: 200 - value: b'2021:03:03 20:58:12\x00' DEBUG:PIL.TiffImagePlugin:tag: UserComment (37510) - type: string (2) Tag Location: 184 - Data Location: 220 - value: <table: 34 bytes> DEBUG:PIL.TiffImagePlugin:tag: LightSource (37384) - type: long (4) - value: b'\x00\x00\x00\x00' DEBUG:root:imgformat = JPEG DEBUG:root:input dpi = 72 x 72 ERROR:root:error: Invalid rotation (0) Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/img2pdf.py", line 3629, in main convert( File "/usr/lib/python3.9/site-packages/img2pdf.py", line 2032, in convert ) in read_images(rawdata, kwargs["colorspace"], kwargs["first_frame_only"]): File "/usr/lib/python3.9/site-packages/img2pdf.py", line 1374, in read_images color, ndpi, imgwidthpx, imgheightpx, rotation, iccp = get_imgmetadata( File "/usr/lib/python3.9/site-packages/img2pdf.py", line 1224, in get_imgmetadata raise ExifOrientationError("Invalid rotation (%d)" % value) img2pdf.ExifOrientationError: Invalid rotation (0) ``` **Example file** [scan.zip](https://github.com/jbarlow83/OCRmyPDF/files/6082263/scan.zip) **Expected behavior** No error should happen. **System** - OS: Archlinux - img2pdf version: img2pdf 0.4.0 --- *By tester123123 on 2021-03-04T14:27:30.643Z* --- After a bit of research the app seems to write an invalid rotation value: https://github.com/allgood/OpenNoteScanner/issues/248 --- *By tester123123 on 2021-03-04T14:27:30.778Z* --- Status changed to closed --- *By josch on 2021-03-04T16:50:28.964Z* --- That assessment is correct. You should file a bug against "Open Note Scanner". Thank you!
josch closed this issue 3 years ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: josch/img2pdf#90
Loading…
There is no content yet.