indus/kubi

IIIF layout not working

cmahnke opened this issue · 3 comments

Testet on MacOS, Python installed by Homebrew:

 /opt/homebrew/bin/kubi -co layout=iiif  static/images/FW-Handeln-000.jpg test
Traceback (most recent call last):
  File "/opt/homebrew/bin/kubi", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/kubi/kubi.py", line 347, in run
    main(sys.argv[1:])
  File "/opt/homebrew/lib/python3.11/site-packages/kubi/kubi.py", line 343, in main
    kubi(args)
  File "/opt/homebrew/lib/python3.11/site-packages/kubi/kubi.py", line 227, in kubi
    mapim.write_to_file(f'{dst}_{fn}{dst_ext}', **args.co)
  File "/opt/homebrew/lib/python3.11/site-packages/pyvips/vimage.py", line 804, in write_to_file
    return pyvips.Operation.call(name, self, filename,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pyvips/voperation.py", line 288, in call
    raise Error('{0} does not support optional argument {1}'
pyvips.error.Error: VipsForeignSaveJpegFile does not support optional argument layout

It seems that pyvips doesn't handle the supplied parameter. I'm not sure if it's related to the fact that I omitted some possible parameters. If that's the case there is a sanity check missing.

As far as I can see and remember from working wit vips directly the layout option needs to be passed to dzsave...

indus commented

I don't think missing paramters are a problem. Can you try:
/opt/homebrew/bin/kubi -co layout=iiif static/images/FW-Handeln-000.jpg test.dz
or
/opt/homebrew/bin/kubi -co layout=iiif -co suffix=.jpg static/images/FW-Handeln-000.jpg test.dz

Thanks! That works, but putting semantics into a parameter, which is labeled destdir is a bit counter intuitive. Maybe something like this is better implemented as a parameter on it's own, maybe optional, to keep the current convention...

At least the exception should be caught to generate a meaningful error message.

Should I rename this issue?

indus commented