How to convert multiple files, keeping the same name

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rekam
Posts: 2
Joined: 2012-07-17T06:58:54-07:00
Authentication code: 15

How to convert multiple files, keeping the same name

Post by rekam »

Hi !

I searched bit and tried a little bit, but I can't find a solution to this: I have multiple PCT files that I want to transform to jpeg. To convert one, I do:

Code: Select all

convert -quality 100 1.pct 1.jpg
Easy and it works. But then I have tons of pct files. So

Code: Select all

convert -quality 100 *.pct jpg
.. does the trick, but then my jpg files aren't named correctly. I tried with some #, *, {0}, _, | and other signs but any of them just keep the name for each photo.

What do I need to do to just change the extension?

Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to convert multiple files, keeping the same name

Post by fmw42 »

see mogrify

http://www.imagemagick.org/Usage/basics/#mogrify

but I recommend you use the path option so as not to overwrite your original images.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to convert multiple files, keeping the same name

Post by anthony »

If going to a different format use -format jpg with mogrify
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rekam
Posts: 2
Joined: 2012-07-17T06:58:54-07:00
Authentication code: 15

Re: How to convert multiple files, keeping the same name

Post by rekam »

anthony wrote:If going to a different format use -format jpg with mogrify
Thanks, that's it!

Here's the code I used:

Code: Select all

mogrify -format pct *.jpg
Post Reply