dfd-tud / deda

https://dfd.inf.tu-dresden.de
GNU General Public License v3.0
1.57k stars 92 forks source link

PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7ffeefadcfe0> #27

Closed p1r473 closed 5 months ago

p1r473 commented 5 months ago
❯ deda_anonmask_create -w
testpage.pdf written.                                                                                                                                    
❯ deda_parse_print testpage.pdf
Traceback (most recent call last):
  File "/root/.local/bin/deda_parse_print", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/.local/lib/python3.11/site-packages/deda_bin/deda_parse_print.py", line 83, in <lambda>
    main = lambda:Main()()
                  ^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/deda_bin/deda_parse_print.py", line 40, in __call__
    pp = PrintParser(fp.read(),ydxArgs=dict(mask=self.args.mask,
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/libdeda/print_parser.py", line 67, in __init__
    self._createYD_instance(ydColourRange=cp)
  File "/root/.local/lib/python3.11/site-packages/libdeda/print_parser.py", line 87, in _createYD_instance
    yd = YDX(**ydxArgs)
         ^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/libdeda/extract_yd.py", line 616, in __init__
    CommonImageFunctions.__init__(
  File "/root/.local/lib/python3.11/site-packages/libdeda/extract_yd.py", line 136, in __init__
    self.imgDpi = inputDpi if inputDpi else self.getImgDpi(image)
                                            ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/libdeda/extract_yd.py", line 143, in getImgDpi
    with Image.open(im) as pilimg:
         ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 3283, in open
    raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7fff174d6ac0>  
timojuez commented 5 months ago

Hey.

I don't really remember if we support pdf input. Can you try with png?

p1r473 @.***> schrieb am Fr., 5. Apr. 2024, 14:37:

deda_parse_print new_dots.pdf

Traceback (most recent call last): File "/root/.local/bin/deda_parse_print", line 8, in sys.exit(main()) ^^^^^^ File "/root/.local/lib/python3.11/site-packages/deda_bin/deda_parse_print.py", line 83, in main = lambda:Main()() ^^^^^^^^ File "/root/.local/lib/python3.11/site-packages/deda_bin/deda_parse_print.py", line 40, in call pp = PrintParser(fp.read(),ydxArgs=dict(mask=self.args.mask, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/lib/python3.11/site-packages/libdeda/print_parser.py", line 67, in init self._createYD_instance(ydColourRange=cp) File "/root/.local/lib/python3.11/site-packages/libdeda/print_parser.py", line 87, in _createYD_instance yd = YDX(**ydxArgs) ^^^^^^^^^^^^^^ File "/root/.local/lib/python3.11/site-packages/libdeda/extract_yd.py", line 616, in init CommonImageFunctions.init( File "/root/.local/lib/python3.11/site-packages/libdeda/extract_yd.py", line 136, in init self.imgDpi = inputDpi if inputDpi else self.getImgDpi(image) ^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/lib/python3.11/site-packages/libdeda/extract_yd.py", line 143, in getImgDpi with Image.open(im) as pilimg: ^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/PIL/Image.py", line 3283, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7ffeefadcfe0>

— Reply to this email directly, view it on GitHub https://github.com/dfd-tud/deda/issues/27, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCBCD5HEWJIGMPAMYCPY6TY3ZIB3AVCNFSM6AAAAABFYVCWYWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIZDOMRYHA2TKNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

p1r473 commented 5 months ago

You were right, had to use an image and not a pdf.