Converting Multiple Files with Imagemagick Convert

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?".
Locked
Ninja Joe
Posts: 10
Joined: 2020-03-27T21:18:48-07:00
Authentication code: 1152

Converting Multiple Files with Imagemagick Convert

Post 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?

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting Multiple Files with Imagemagick Convert

Post 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.
snibgo's IM pages: im.snibgo.com

Ninja Joe
Posts: 10
Joined: 2020-03-27T21:18:48-07:00
Authentication code: 1152

Re: Converting Multiple Files with Imagemagick Convert

Post 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

Ninja Joe
Posts: 10
Joined: 2020-03-27T21:18:48-07:00
Authentication code: 1152

Re: Converting Multiple Files with Imagemagick Convert

Post by Ninja Joe »

I got it! It was:

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

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting Multiple Files with Imagemagick Convert

Post 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.
snibgo's IM pages: im.snibgo.com

Locked