lovell / avif-cli

Command line utility to convert images to AVIF
Apache License 2.0
175 stars 18 forks source link

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

Closed ThatOneCalculator closed 11 months ago

ThatOneCalculator commented 11 months ago

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 11 months ago

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.

ThatOneCalculator commented 11 months ago

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

lovell commented 11 months ago

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.

ThatOneCalculator commented 11 months ago

Ah, gotcha