Inkscape.org
Creating New Extensions Using Pillow to handle multipage tiffs
  1. #1
    Glord Glord @Glord
    Hello! I am trying to write a simple python extension for Inkscape 1.0 (beta) that opens a multipage tiff file, resizes the pages and adds them as layers into the svg. I was hoping to use PIL (Pillow) that comes bundled with the python interpreter for this. However, I am having trouble loading the tiffs i.e. `image.load()`. It works fine in an external virtual environment with the same version of Pillow. Any thoughts?
     
    I know Pillow calls out to `libtiff` to handle tiffs so I suspect it is related to using the system venv's `libtiff` vs inkscape's (copy of?) `libtiff`...

    Minimal code example:
     
    from PIL import Image
    image = Image.open('multipage_tif_example.tif`)
    image.load()
    
    
    Errors:
    tempfile.tif: Cannot read TIFF header.
    OSError: -2
  2. #2
    Maren Hachmann Maren Hachmann @Moini

    What type of Inkscape installation have you been using for your test? Which operating system?

Inkscape Inkscape.org Inkscape Forum Creating New Extensions Using Pillow to handle multipage tiffs