lovell/avif-cli

"Cannot use same file for input and output" when `--overwrite` is passed

Closed this issue · 4 comments

Despite passing --overwrite, running bunx avif --verbose --input="${filename}" --effort=9 --quality=60 --overwrite gives "Cannot use same file for input and output"

lovell commented

The --overwrite flag allows any existing output files to be overwritten, but it does not allow any existing input files to be overwritten. What is the value of ${filename}? I suspect you're including AVIF file(s) as input.

Yep, the goal was to re-encode an avif to further compress it

lovell commented

Thanks for confirming, there's not a lot we can do here as it is a design feature of libvips to overlap input and output, which means you can't write to a file you're still reading from.

Ah, gotcha