mogrify and 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?".
Post Reply
UliW
Posts: 19
Joined: 2017-07-19T08:15:59-07:00
Authentication code: 1151

mogrify and convert

Post by UliW »

Dear all,
I am about to convert a number of files which are all in C:\temp\bildbearbeitung
“test1”, “test2” …..

C:
cd \temp\bildbearbeitung
C:\Programme\ImageMagick-7.0.6-Q16\magick mogrify -path C:\temp\bildgroesse -resize 16% -compress LZW *.tif

I resize, compress and save them in another directory C:\temp\bildgroesse. It works well thanks to fmw42 and snibgo.

Now I want to change the name of the output file from “test1” to “test 1_org”, “test2” to “test2_org” and so on.

I tried in vain
C:
cd \temp\bildbearbeitung
C:\Programme\ImageMagick-7.0.6-Q16\magick mogrify -path C:\temp\bildgroesse -resize 16% -compress LZW -set filename:f %t_org %[filename:f].tif *.tif

I got the message: mogrify: unable to open image '%[filename:f].tif': No such file or directory @ error/blob.c/OpenBlob/3109.

Is it correct that mogify can not set filenames?
So I tried the convert command

cd \temp\bildbearbeitung
C:\Programme\ImageMagick-7.0.6-Q16\magick mogrify -path C:\temp\bildgroesse -resize 16% -compress LZW *.tif
cd \temp\bildgroesse
C:\Programme\ImageMagick-7.0.6-Q16\magick convert *.tif -compress LZW -set filename:f %t_org %[filename:f].tif

it works but only for the first file and blows it up (from 0.8 MB to 8 MB). By the way there is the same result for "filename:t %t_org %[filename:t]" and "filename:f %f_org %[filename:f]",

Am I right that mogrify can not use “set file name”? Why is the command line with the “convert -set filename” only working for the first file?
How to delete the old files “test1”, “test2” ….?

Thanks for your help
Uli
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: mogrify and convert

Post by snibgo »

Mogrify cannot change filenames.

"convert" works differently to "mogify".

Code: Select all

C:\Programme\ImageMagick-7.0.6-Q16\magick convert *.tif -compress LZW -set filename:f %t_org %[filename:f].tif
This command would read all your *.tif files, and write them into a single output tif file.
snibgo's IM pages: im.snibgo.com
UliW
Posts: 19
Joined: 2017-07-19T08:15:59-07:00
Authentication code: 1151

Re: mogrify and convert

Post by UliW »

Thank you,
now I know why the one file is so big.
But what I should write instead and how to delete the files with the old name?

Thanks
Uli
UliW
Posts: 19
Joined: 2017-07-19T08:15:59-07:00
Authentication code: 1151

Re: mogrify and convert

Post by UliW »

Dear All,
at the end I managed to solve the problem.

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

Re: mogrify and convert

Post by fmw42 »

Could you tell us what the problem was and how you solved it? That could help others later on.
Post Reply