libvips / pyvips

python binding for libvips using cffi
MIT License
649 stars 50 forks source link

Write_to_image with zstd compression: "ZSTD compression support is not configured" #432

Closed pmascalchi closed 1 year ago

pmascalchi commented 1 year ago

Hello,

I'm trying to figure out how compression libs need to be setup but I couldn't find code examples. I looked at several pages among the great: https://www.libvips.org/API/current/VipsForeignSave.html#vips-tiffsave

When I run something like: final_image.write_to_file(out_path, compression='zstd', level=0, miniswhite=False, bigtiff=True)

I get this type of error message: target output: ZSTD compression support is not configured

Vips package tested: vips-dev-w64-all-8.14.5.zip

Any advice on how to configure zstd or other compression methods?

Thanks!

jcupitt commented 1 year ago

Hi @pmascalchi,

You need to configure zstd compression when you build libtiff, so you'll need to rebuild everything from source. I'd start with:

https://github.com/libvips/build-win64-mxe

Or alternatively, use ubuntu under wsl2, since ubuntu comes with libvips, and their tibtiff has zstd compression enabled. It's just:

$ sudo apt install libvips-tools
$ vips copy k2.jpg x.tif[compression=zstd]
pmascalchi commented 1 year ago

Hi @jcupitt,

Thanks a lot for the explanation, makes more sense now :)