ImageMagick command to convert and save with same name

Another way:

convert *.jpg -resize 80% -set filename:f '%t' ../'%[filename:f].jpg'

Will place converted files in the folder above.

The option -set filename:f '%t' sets the property filename:f to the current filename without the extension. Properties beginning with filename: are a special case that can be referenced in the output filename. Here we set it to ../'%[filename:f].jpg, which ends up being the image filename with the extension replaced with .jpg in the parent directory.

Documentation references:

  • -set documentation, which mentions the filename: special case
  • %t and other Format and Print Image Properties

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)