error: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object. #132

Closed
opened 2 years ago by MattisLind · 14 comments

Trying to use img2pdf on Macos 11.3.1, python3 version 3.9.10
Cloned 3da370d3bd and did the install as in the README.md

% img2pdf --output doc.pdf *.tif
error: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object.

Googling a bit gave this: https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1836703.html

Is it related somehow?

Trying to use img2pdf on Macos 11.3.1, python3 version 3.9.10 Cloned 3da370d3bd4a04822bf0a7611a55ab7eb0beff48 and did the install as in the README.md ``` % img2pdf --output doc.pdf *.tif error: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object. ``` Googling a bit gave this: [https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1836703.html](htthttps://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1836703.htmlps://) Is it related somehow?
josch commented 2 years ago
Owner

Maybe. Can you share your input tif image?

Maybe. Can you share your input tif image?
Poster
Here is a link to a tif that it chokes on: [https://drive.google.com/file/d/1YH3SWGaWeo78MtLTQFMOXFMoVX8PaYbR/view?usp=sharing](https://drive.google.com/file/d/1YH3SWGaWeo78MtLTQFMOXFMoVX8PaYbR/view?usp=sharing)
Poster

But it appear not be to be this specific file that causes it. Downloaded a sample tif that I got from a few seconds of googling and it give the same result:

https://people.math.sc.edu/Burkardt/data/tif/at3_1m4_01.tif

But it appear not be to be this specific file that causes it. Downloaded a sample tif that I got from a few seconds of googling and it give the same result: [https://people.math.sc.edu/Burkardt/data/tif/at3_1m4_01.tif](https://people.math.sc.edu/Burkardt/data/tif/at3_1m4_01.tif)
josch commented 2 years ago
Owner

Interesting. It doesn't fail for me. Can you run img2pdf with --verbose to get a better error message?

Interesting. It doesn't fail for me. Can you run img2pdf with --verbose to get a better error message?
Poster

Here is the full log using the file mentioned above.

DEBUG:PIL.TiffImagePlugin:*** TiffImageFile._open ***
DEBUG:PIL.TiffImagePlugin:- __first: 309596
DEBUG:PIL.TiffImagePlugin:- ifh: b'II*\x00\\\xb9\x04\x00'
DEBUG:PIL.TiffImagePlugin:Seeking to frame 0, on frame -1, __next 309596, location: 8
DEBUG:PIL.TiffImagePlugin:Loading tags, location: 309596
DEBUG:PIL.TiffImagePlugin:tag: ImageWidth (256) - type: short (3) - value: b'\x80\x02'
DEBUG:PIL.TiffImagePlugin:tag: ImageLength (257) - type: short (3) - value: b'\xe0\x01'
DEBUG:PIL.TiffImagePlugin:tag: BitsPerSample (258) - type: short (3) - value: b'\x08\x00'
DEBUG:PIL.TiffImagePlugin:tag: Compression (259) - type: short (3) - value: b'\x05\x80'
DEBUG:PIL.TiffImagePlugin:tag: PhotometricInterpretation (262) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: ImageDescription (270) - type: string (2) Tag Location: 309670 - Data Location: 309782 - value: <table: 84 bytes>
DEBUG:PIL.TiffImagePlugin:tag: StripOffsets (273) - type: long (4) Tag Location: 309682 - Data Location: 309866 - value: <table: 160 bytes>
DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: SamplesPerPixel (277) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: RowsPerStrip (278) - type: short (3) - value: b'\x0c\x00'
DEBUG:PIL.TiffImagePlugin:tag: StripByteCounts (279) - type: long (4) Tag Location: 309730 - Data Location: 310026 - value: <table: 160 bytes>
DEBUG:PIL.TiffImagePlugin:tag: XResolution (282) - type: rational (5) Tag Location: 309742 - Data Location: 310186 - value: b'\x00\x00\x00H\x00\x00\x00\x01'
DEBUG:PIL.TiffImagePlugin:tag: YResolution (283) - type: rational (5) Tag Location: 309754 - Data Location: 310194 - value: b'\x00\x00\x00H\x00\x00\x00\x01'
DEBUG:PIL.TiffImagePlugin:tag: PlanarConfiguration (284) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: ResolutionUnit (296) - type: short (3) - value: b'\x02\x00'
DEBUG:PIL.TiffImagePlugin:tag: ImageWidth (256) - type: short (3) - value: b'\x80\x02'
DEBUG:PIL.TiffImagePlugin:tag: ImageLength (257) - type: short (3) - value: b'\xe0\x01'
DEBUG:PIL.TiffImagePlugin:tag: BitsPerSample (258) - type: short (3) - value: b'\x08\x00'
DEBUG:PIL.TiffImagePlugin:tag: Compression (259) - type: short (3) - value: b'\x05\x80'
DEBUG:PIL.TiffImagePlugin:tag: PhotometricInterpretation (262) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: ImageDescription (270) - type: string (2) Tag Location: 309670 - Data Location: 309782 - value: <table: 84 bytes>
DEBUG:PIL.TiffImagePlugin:tag: StripOffsets (273) - type: long (4) Tag Location: 309682 - Data Location: 309866 - value: <table: 160 bytes>
DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: SamplesPerPixel (277) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: RowsPerStrip (278) - type: short (3) - value: b'\x0c\x00'
DEBUG:PIL.TiffImagePlugin:tag: StripByteCounts (279) - type: long (4) Tag Location: 309730 - Data Location: 310026 - value: <table: 160 bytes>
DEBUG:PIL.TiffImagePlugin:tag: XResolution (282) - type: rational (5) Tag Location: 309742 - Data Location: 310186 - value: b'\x00\x00\x00H\x00\x00\x00\x01'
DEBUG:PIL.TiffImagePlugin:tag: YResolution (283) - type: rational (5) Tag Location: 309754 - Data Location: 310194 - value: b'\x00\x00\x00H\x00\x00\x00\x01'
DEBUG:PIL.TiffImagePlugin:tag: PlanarConfiguration (284) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: ResolutionUnit (296) - type: short (3) - value: b'\x02\x00'
DEBUG:PIL.TiffImagePlugin:*** Summary ***
DEBUG:PIL.TiffImagePlugin:- compression: packbits
DEBUG:PIL.TiffImagePlugin:- photometric_interpretation: 1
DEBUG:PIL.TiffImagePlugin:- planar_configuration: 1
DEBUG:PIL.TiffImagePlugin:- fill_order: 1
DEBUG:PIL.TiffImagePlugin:- YCbCr subsampling: None
DEBUG:PIL.TiffImagePlugin:- size: (640, 480)
DEBUG:PIL.TiffImagePlugin:format key: (b'II', 1, (1,), 1, (8,), ())
DEBUG:PIL.TiffImagePlugin:- raw mode: L
DEBUG:PIL.TiffImagePlugin:- pil mode: L
DEBUG:img2pdf:PIL format = TIFF
DEBUG:img2pdf:imgformat = TIFF
DEBUG:img2pdf:Converting frame: 0
DEBUG:img2pdf:input dpi = 72 x 72
DEBUG:img2pdf:rotation = 0°
DEBUG:img2pdf:input colorspace = L
DEBUG:img2pdf:width x height = 640px x 480px
DEBUG:img2pdf:Colorspace is OK: Colorspace.L
DEBUG:PIL.TiffImagePlugin:have getvalue. just sending in a string from getvalue
DEBUG:PIL.TiffImagePlugin:tag: ImageWidth (256) - type: short (3) - value: b'\x80\x02'
DEBUG:PIL.TiffImagePlugin:tag: ImageLength (257) - type: short (3) - value: b'\xe0\x01'
DEBUG:PIL.TiffImagePlugin:tag: BitsPerSample (258) - type: short (3) - value: b'\x08\x00'
DEBUG:PIL.TiffImagePlugin:tag: Compression (259) - type: short (3) - value: b'\x05\x80'
DEBUG:PIL.TiffImagePlugin:tag: PhotometricInterpretation (262) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: ImageDescription (270) - type: string (2) Tag Location: 309670 - Data Location: 309782 - value: <table: 84 bytes>
DEBUG:PIL.TiffImagePlugin:tag: StripOffsets (273) - type: long (4) Tag Location: 309682 - Data Location: 309866 - value: <table: 160 bytes>
DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: SamplesPerPixel (277) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: RowsPerStrip (278) - type: short (3) - value: b'\x0c\x00'
DEBUG:PIL.TiffImagePlugin:tag: StripByteCounts (279) - type: long (4) Tag Location: 309730 - Data Location: 310026 - value: <table: 160 bytes>
DEBUG:PIL.TiffImagePlugin:tag: XResolution (282) - type: rational (5) Tag Location: 309742 - Data Location: 310186 - value: b'\x00\x00\x00H\x00\x00\x00\x01'
DEBUG:PIL.TiffImagePlugin:tag: YResolution (283) - type: rational (5) Tag Location: 309754 - Data Location: 310194 - value: b'\x00\x00\x00H\x00\x00\x00\x01'
DEBUG:PIL.TiffImagePlugin:tag: PlanarConfiguration (284) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: ResolutionUnit (296) - type: short (3) - value: b'\x02\x00'
DEBUG:img2pdf:read_images() encoded an image as PNG
ERROR:img2pdf:error: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/img2pdf.py", line 3975, in main
    convert(
  File "/usr/local/lib/python3.9/site-packages/img2pdf.py", line 2341, in convert
    pdf.tostream(kwargs["outputstream"])
  File "/usr/local/lib/python3.9/site-packages/img2pdf.py", line 1111, in tostream
    initial_page = self.writer.make_indirect(initial_page)
TypeError: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object.
Here is the full log using the file mentioned above. ``` DEBUG:PIL.TiffImagePlugin:*** TiffImageFile._open *** DEBUG:PIL.TiffImagePlugin:- __first: 309596 DEBUG:PIL.TiffImagePlugin:- ifh: b'II*\x00\\\xb9\x04\x00' DEBUG:PIL.TiffImagePlugin:Seeking to frame 0, on frame -1, __next 309596, location: 8 DEBUG:PIL.TiffImagePlugin:Loading tags, location: 309596 DEBUG:PIL.TiffImagePlugin:tag: ImageWidth (256) - type: short (3) - value: b'\x80\x02' DEBUG:PIL.TiffImagePlugin:tag: ImageLength (257) - type: short (3) - value: b'\xe0\x01' DEBUG:PIL.TiffImagePlugin:tag: BitsPerSample (258) - type: short (3) - value: b'\x08\x00' DEBUG:PIL.TiffImagePlugin:tag: Compression (259) - type: short (3) - value: b'\x05\x80' DEBUG:PIL.TiffImagePlugin:tag: PhotometricInterpretation (262) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: ImageDescription (270) - type: string (2) Tag Location: 309670 - Data Location: 309782 - value: <table: 84 bytes> DEBUG:PIL.TiffImagePlugin:tag: StripOffsets (273) - type: long (4) Tag Location: 309682 - Data Location: 309866 - value: <table: 160 bytes> DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: SamplesPerPixel (277) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: RowsPerStrip (278) - type: short (3) - value: b'\x0c\x00' DEBUG:PIL.TiffImagePlugin:tag: StripByteCounts (279) - type: long (4) Tag Location: 309730 - Data Location: 310026 - value: <table: 160 bytes> DEBUG:PIL.TiffImagePlugin:tag: XResolution (282) - type: rational (5) Tag Location: 309742 - Data Location: 310186 - value: b'\x00\x00\x00H\x00\x00\x00\x01' DEBUG:PIL.TiffImagePlugin:tag: YResolution (283) - type: rational (5) Tag Location: 309754 - Data Location: 310194 - value: b'\x00\x00\x00H\x00\x00\x00\x01' DEBUG:PIL.TiffImagePlugin:tag: PlanarConfiguration (284) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: ResolutionUnit (296) - type: short (3) - value: b'\x02\x00' DEBUG:PIL.TiffImagePlugin:tag: ImageWidth (256) - type: short (3) - value: b'\x80\x02' DEBUG:PIL.TiffImagePlugin:tag: ImageLength (257) - type: short (3) - value: b'\xe0\x01' DEBUG:PIL.TiffImagePlugin:tag: BitsPerSample (258) - type: short (3) - value: b'\x08\x00' DEBUG:PIL.TiffImagePlugin:tag: Compression (259) - type: short (3) - value: b'\x05\x80' DEBUG:PIL.TiffImagePlugin:tag: PhotometricInterpretation (262) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: ImageDescription (270) - type: string (2) Tag Location: 309670 - Data Location: 309782 - value: <table: 84 bytes> DEBUG:PIL.TiffImagePlugin:tag: StripOffsets (273) - type: long (4) Tag Location: 309682 - Data Location: 309866 - value: <table: 160 bytes> DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: SamplesPerPixel (277) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: RowsPerStrip (278) - type: short (3) - value: b'\x0c\x00' DEBUG:PIL.TiffImagePlugin:tag: StripByteCounts (279) - type: long (4) Tag Location: 309730 - Data Location: 310026 - value: <table: 160 bytes> DEBUG:PIL.TiffImagePlugin:tag: XResolution (282) - type: rational (5) Tag Location: 309742 - Data Location: 310186 - value: b'\x00\x00\x00H\x00\x00\x00\x01' DEBUG:PIL.TiffImagePlugin:tag: YResolution (283) - type: rational (5) Tag Location: 309754 - Data Location: 310194 - value: b'\x00\x00\x00H\x00\x00\x00\x01' DEBUG:PIL.TiffImagePlugin:tag: PlanarConfiguration (284) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: ResolutionUnit (296) - type: short (3) - value: b'\x02\x00' DEBUG:PIL.TiffImagePlugin:*** Summary *** DEBUG:PIL.TiffImagePlugin:- compression: packbits DEBUG:PIL.TiffImagePlugin:- photometric_interpretation: 1 DEBUG:PIL.TiffImagePlugin:- planar_configuration: 1 DEBUG:PIL.TiffImagePlugin:- fill_order: 1 DEBUG:PIL.TiffImagePlugin:- YCbCr subsampling: None DEBUG:PIL.TiffImagePlugin:- size: (640, 480) DEBUG:PIL.TiffImagePlugin:format key: (b'II', 1, (1,), 1, (8,), ()) DEBUG:PIL.TiffImagePlugin:- raw mode: L DEBUG:PIL.TiffImagePlugin:- pil mode: L DEBUG:img2pdf:PIL format = TIFF DEBUG:img2pdf:imgformat = TIFF DEBUG:img2pdf:Converting frame: 0 DEBUG:img2pdf:input dpi = 72 x 72 DEBUG:img2pdf:rotation = 0° DEBUG:img2pdf:input colorspace = L DEBUG:img2pdf:width x height = 640px x 480px DEBUG:img2pdf:Colorspace is OK: Colorspace.L DEBUG:PIL.TiffImagePlugin:have getvalue. just sending in a string from getvalue DEBUG:PIL.TiffImagePlugin:tag: ImageWidth (256) - type: short (3) - value: b'\x80\x02' DEBUG:PIL.TiffImagePlugin:tag: ImageLength (257) - type: short (3) - value: b'\xe0\x01' DEBUG:PIL.TiffImagePlugin:tag: BitsPerSample (258) - type: short (3) - value: b'\x08\x00' DEBUG:PIL.TiffImagePlugin:tag: Compression (259) - type: short (3) - value: b'\x05\x80' DEBUG:PIL.TiffImagePlugin:tag: PhotometricInterpretation (262) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: ImageDescription (270) - type: string (2) Tag Location: 309670 - Data Location: 309782 - value: <table: 84 bytes> DEBUG:PIL.TiffImagePlugin:tag: StripOffsets (273) - type: long (4) Tag Location: 309682 - Data Location: 309866 - value: <table: 160 bytes> DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: SamplesPerPixel (277) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: RowsPerStrip (278) - type: short (3) - value: b'\x0c\x00' DEBUG:PIL.TiffImagePlugin:tag: StripByteCounts (279) - type: long (4) Tag Location: 309730 - Data Location: 310026 - value: <table: 160 bytes> DEBUG:PIL.TiffImagePlugin:tag: XResolution (282) - type: rational (5) Tag Location: 309742 - Data Location: 310186 - value: b'\x00\x00\x00H\x00\x00\x00\x01' DEBUG:PIL.TiffImagePlugin:tag: YResolution (283) - type: rational (5) Tag Location: 309754 - Data Location: 310194 - value: b'\x00\x00\x00H\x00\x00\x00\x01' DEBUG:PIL.TiffImagePlugin:tag: PlanarConfiguration (284) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: ResolutionUnit (296) - type: short (3) - value: b'\x02\x00' DEBUG:img2pdf:read_images() encoded an image as PNG ERROR:img2pdf:error: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object. Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/img2pdf.py", line 3975, in main convert( File "/usr/local/lib/python3.9/site-packages/img2pdf.py", line 2341, in convert pdf.tostream(kwargs["outputstream"]) File "/usr/local/lib/python3.9/site-packages/img2pdf.py", line 1111, in tostream initial_page = self.writer.make_indirect(initial_page) TypeError: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object. ```

I think this exception is raised by pikepdf in object_convert.cpp and related to the changes in commit pikepdf/8255bc3. In the meantime, you could use the internal PDF backend of img2pdf: --engine internal.

I think this exception is raised by pikepdf in `object_convert.cpp` and related to the changes in commit [pikepdf/8255bc3](https://github.com/pikepdf/pikepdf/commit/8255bc361cd402261415f3bbe90280c38b702ab4). In the meantime, you could use the internal PDF backend of img2pdf: `--engine internal`.
Poster

Thanks. That indeed prevented it from crashing.

But the file got every picture repeated twice. The second one with much lower resolution.

% img2pdf --engine internal  Facit4431_1.tif Facit4431_2.tif Facit4431_3.tif   -o Facit4431_full.pdf

https://drive.google.com/file/d/1lE2jr-8Fa4FUPX9tE66UuovXcqUREWTy/view?usp=sharing

Interestingly the full res pictures are shown as white in Google Drive viewer while they display perfectly in Macos Preview. Perhaps the image size (5000x7000 pixels) is to big for the Google Drive viewer? But show this second identical image.

How can I get rid of this low resolution "thumbnail" picture spliced in after each picture?

Thanks. That indeed prevented it from crashing. But the file got every picture repeated twice. The second one with much lower resolution. ``` % img2pdf --engine internal Facit4431_1.tif Facit4431_2.tif Facit4431_3.tif -o Facit4431_full.pdf ``` [https://drive.google.com/file/d/1lE2jr-8Fa4FUPX9tE66UuovXcqUREWTy/view?usp=sharing](https://drive.google.com/file/d/1lE2jr-8Fa4FUPX9tE66UuovXcqUREWTy/view?usp=sharing) Interestingly the full res pictures are shown as white in Google Drive viewer while they display perfectly in Macos Preview. Perhaps the image size (5000x7000 pixels) is to big for the Google Drive viewer? But show this second identical image. How can I get rid of this low resolution "thumbnail" picture spliced in after each picture?

I believe you need --first-frame-only. (Your image apparently has an embedded thumbnail as second frame.)

I believe you need `--first-frame-only`. (Your image apparently has an embedded thumbnail as second frame.)
Poster

Thanks a lot! Indeed that solved the problem. Wasn't expecting there to be a thumbnail embedded. Feel free to close the issue.

Thanks a lot! Indeed that solved the problem. Wasn't expecting there to be a thumbnail embedded. Feel free to close the issue.

You're welcome, glad I could help.
The issue with the pikepdf backend that you reported is a valid problem, thus I'd say the ticket should remain open until this is addressed.

You're welcome, glad I could help. The issue with the pikepdf backend that you reported is a valid problem, thus I'd say the ticket should remain open until this is addressed.
josch commented 2 years ago
Owner

As I'm unable to reproduce this problem, can one of you who can reproduce it file a bug against pikepdf? Thanks!

As I'm unable to reproduce this problem, can one of you who can reproduce it file a bug against pikepdf? Thanks!
josch commented 2 years ago
Owner

@mara0004 I think maybe you deleted your last comment?

I have python3-pikepdf 4.2.0 installed and as far as I can see, pikepdf/8255bc3 was already included in 4.2.0.

@mara0004 I think maybe you deleted your last comment? I have python3-pikepdf 4.2.0 installed and as far as I can see, [pikepdf/8255bc3](https://github.com/pikepdf/pikepdf/commit/8255bc361cd402261415f3bbe90280c38b702ab4) was already included in 4.2.0.

Calling it with pdf arranger froze it whatever the png. CLI verbose gave this
(Manjaro, git compile, python3-pikepdf 5.0.1-1)

$ img2pdf '/home/kacey/Downloads/IDs/Kim'\''s/Bank balance.png' --verbose
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'zTXt' 41 139
DEBUG:PIL.PngImagePlugin:STREAM b'iTXt' 192 2566
DEBUG:PIL.PngImagePlugin:STREAM b'sBIT' 2770 3
DEBUG:PIL.PngImagePlugin:b'sBIT' 2770 3 (unknown)
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 2785 8192
DEBUG:img2pdf:PIL format = PNG
DEBUG:img2pdf:imgformat = PNG
DEBUG:img2pdf:input dpi = 96 x 96
DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x01\x00'
DEBUG:PIL.TiffImagePlugin:tag: Software (305) - type: string (2) Tag Location: 34 - Data Location: 50 - value: b'Shotwell 0.30.14\x00'
DEBUG:PIL.TiffImagePlugin:tag: ExifIFD (34665) - type: long (4) - value: b'D\x00\x00\x00'
DEBUG:PIL.TiffImagePlugin:tag: PixelXDimension (40962) - type: signed long (9) - value: b'X\x02\x00\x00'
DEBUG:PIL.TiffImagePlugin:tag: PixelYDimension (40963) - type: signed long (9) - value: b'\x87\x03\x00\x00'
DEBUG:PIL.TiffImagePlugin:tag: PixelXDimension (40962) - type: signed long (9) - value: b'X\x02\x00\x00'
DEBUG:PIL.TiffImagePlugin:tag: PixelYDimension (40963) - type: signed long (9) - value: b'\x87\x03\x00\x00'
DEBUG:img2pdf:rotation = 0°
DEBUG:img2pdf:input colorspace = RGB
DEBUG:img2pdf:width x height = 600px x 903px
DEBUG:img2pdf:read_images() embeds a PNG
ERROR:img2pdf:error: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object.
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/img2pdf.py", line 3975, in main
    convert(
  File "/usr/lib/python3.10/site-packages/img2pdf.py", line 2341, in convert
    pdf.tostream(kwargs["outputstream"])
  File "/usr/lib/python3.10/site-packages/img2pdf.py", line 1111, in tostream
    initial_page = self.writer.make_indirect(initial_page)
TypeError: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object.

Calling it with pdf arranger froze it whatever the png. CLI verbose gave this (Manjaro, git compile, python3-pikepdf 5.0.1-1) ``` $ img2pdf '/home/kacey/Downloads/IDs/Kim'\''s/Bank balance.png' --verbose DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13 DEBUG:PIL.PngImagePlugin:STREAM b'zTXt' 41 139 DEBUG:PIL.PngImagePlugin:STREAM b'iTXt' 192 2566 DEBUG:PIL.PngImagePlugin:STREAM b'sBIT' 2770 3 DEBUG:PIL.PngImagePlugin:b'sBIT' 2770 3 (unknown) DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 2785 8192 DEBUG:img2pdf:PIL format = PNG DEBUG:img2pdf:imgformat = PNG DEBUG:img2pdf:input dpi = 96 x 96 DEBUG:PIL.TiffImagePlugin:tag: Orientation (274) - type: short (3) - value: b'\x01\x00' DEBUG:PIL.TiffImagePlugin:tag: Software (305) - type: string (2) Tag Location: 34 - Data Location: 50 - value: b'Shotwell 0.30.14\x00' DEBUG:PIL.TiffImagePlugin:tag: ExifIFD (34665) - type: long (4) - value: b'D\x00\x00\x00' DEBUG:PIL.TiffImagePlugin:tag: PixelXDimension (40962) - type: signed long (9) - value: b'X\x02\x00\x00' DEBUG:PIL.TiffImagePlugin:tag: PixelYDimension (40963) - type: signed long (9) - value: b'\x87\x03\x00\x00' DEBUG:PIL.TiffImagePlugin:tag: PixelXDimension (40962) - type: signed long (9) - value: b'X\x02\x00\x00' DEBUG:PIL.TiffImagePlugin:tag: PixelYDimension (40963) - type: signed long (9) - value: b'\x87\x03\x00\x00' DEBUG:img2pdf:rotation = 0° DEBUG:img2pdf:input colorspace = RGB DEBUG:img2pdf:width x height = 600px x 903px DEBUG:img2pdf:read_images() embeds a PNG ERROR:img2pdf:error: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object. Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/img2pdf.py", line 3975, in main convert( File "/usr/lib/python3.10/site-packages/img2pdf.py", line 2341, in convert pdf.tostream(kwargs["outputstream"]) File "/usr/lib/python3.10/site-packages/img2pdf.py", line 1111, in tostream initial_page = self.writer.make_indirect(initial_page) TypeError: Can't convert ObjectHelper (or subclass) to Object implicitly. Use .obj to get access the underlying object. ```
josch commented 2 years ago
Owner
I now filed this issue: https://github.com/pikepdf/pikepdf/issues/313
josch closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 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#132
Loading…
There is no content yet.