Page 1 of 1

Converting Multiple Files with Imagemagick Convert

Posted: 2020-03-27T21:24:11-07:00
by Ninja Joe
I have many png files I'd like to convert to jpg. The resulting filenames should end with _b.jpg, e.g., filename.png -> filename_b.jpg.

So far, I have:

convert *.png" -set filename:fname '%t_b' +adjoin '%[filename:fname].jpg'

But it's not producing anything, what am I doing wrong?

Re: Converting Multiple Files with Imagemagick Convert

Posted: 2020-03-27T22:06:34-07:00
by snibgo
What version of IM, on what platform?

Remove the double-quote " .

Provided all your *.png images will fit into your memory at once, it should then work.

Re: Converting Multiple Files with Imagemagick Convert

Posted: 2020-03-27T22:26:57-07:00
by Ninja Joe
I removed the double quote and tried again. It worked! But the filenames had extra single apostrophes '

Original filename:
Scan_20200327.png

New filename:
''Scan_20200327_b'.jpg'

How do I get it to output Scan_20200327_b.jpg instead of ''Scan_20200327_b'.jpg'

The command I entered was:
convert *.png -set filename:fname '%t_b' +adjoin '%[filename:fname].jpg'

Version: ImageMagick 7.0.9-8 Q16 x64
Platform: Windows 10

Re: Converting Multiple Files with Imagemagick Convert

Posted: 2020-03-27T23:57:38-07:00
by Ninja Joe
I got it! It was:

convert *.png -set filename:fname %t_b +adjoin %[filename:fname].jpg

Re: Converting Multiple Files with Imagemagick Convert

Posted: 2020-03-28T00:00:14-07:00
by snibgo
The single quotes are not needed when using bash. But when using Windows, they are positively wrong. Remove them.

Cross-posted: you got it.