#compdef ifind

local curcontext="$curcontext"
typeset -A opt_args

local rc=1
_arguments -s -S \
--help'[show this help message and exit]'\
{-n,--name}'[match files with this glob pattern]'\
--no-recurse'[don'\''t recurse subdirectories]'\
{-f,--format}'[match images with this format]'\
{-w,--width}'[match images with this width]':'<int/expr>'\
{-h,--height}'[match images with this height]':'<int/expr>'\
{-r,--ratio}'[match images with this aspect ratio]'\
--animated'[match animated images]'\
--no-animated'[match non-animated images]'\
--wrong-ext'[match images with the wrong file extension]'\
--ai'[match images with metadata from generative AIs like Stable Diffusion]'\
--no-ai'[do not match images with metadata from generative AIs like Stable Diffusion]'\
--print'[print matching files]'\
--print-comment'[print user comment with matching files]'\
--print-exif'[print all EXIF data with matching files]'\
--exec'[execute this command on each file]'\
--delete'[delete matching files]'\
--dest'[write modified files to this directory]':'<dir>'\
--scale'[scale images relative to original dimensions, e.g. 0.5 to scale to 50%%]'\
--resize-max'[resize images to a maximum dimension, preserving aspect ratio]':'<dim>'\
--resize-w'[resize images to a maximum width, preserving aspect ratio]':'<dim>'\
--resize-h'[resize images to a maximum height, preserving aspect ratio]':'<dim>'\
--convert'[convert images to a new format, e.g. '\''jpg'\'']':'<format>'\
--quality'[compression quality for lossy image formats (default: 80)]' && rc=0

return rc
