Page 1 of 1

Overwrite images with original extensions

Posted: 2019-07-16T03:51:42-07:00
by keljnr
Hi, I have the following script that applies a color profile to any type of image, and then resave's as a jpg using original file name (overwriting the file):

Code: Select all

convert *.* -profile c:\LUTS\sRGB-IEC61966-2.1.icc -set filename:base "%[basename]" "%[filename:base].jpg"
Is there a way I can convert to the original file extension, instead of .jpg.
So if original file was a tif, it overwrites as a tif.

Windows 7

Re: Overwrite images with original extensions

Posted: 2019-07-16T04:52:36-07:00
by snibgo
For escapes, see http://www.imagemagick.org/script/escape.php . Perhaps %[extension] would help.

Re: Overwrite images with original extensions

Posted: 2019-07-16T05:02:02-07:00
by 246246
%f is whole filename. Just replace %[basename] to %f and remove the last ".jpg" at your command.

Re: Overwrite images with original extensions

Posted: 2019-07-16T06:37:50-07:00
by snibgo
Yes, %f is a better and more obvious idea than mine.