Batch Edit

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
digcollib
Posts: 6
Joined: 2018-09-17T11:23:53-07:00
Authentication code: 1152

Batch Edit

Post by digcollib »

Hi--

I am trying to batch edit my files and save them as their original names using the code:

Code: Select all

 magick convert *.tif -colorspace gray -threshold 50% -compress Group4 -set filename:f %t "%[filename:f].tif"
But, they are all saved under the first tif name as almost a pdf, with all of the image combined into the one. Any tips on how to remedy this?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch Edit

Post by snibgo »

Use mogrify.
snibgo's IM pages: im.snibgo.com
digcollib
Posts: 6
Joined: 2018-09-17T11:23:53-07:00
Authentication code: 1152

Re: Batch Edit

Post by digcollib »

How does one use mogrify? I have never heard of this
mattfack
Posts: 3
Joined: 2018-10-08T07:39:01-07:00
Authentication code: 1152

Re: Batch Edit

Post by mattfack »

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

Re: Batch Edit

Post by snibgo »

For a list of ImageMagick tools, see http://www.imagemagick.org/script/comma ... -tools.php

For "magick mogrify" examples and options, see http://www.imagemagick.org/script/mogrify.php
snibgo's IM pages: im.snibgo.com
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Batch Edit

Post by GeeMack »

digcollib wrote: 2018-10-08T07:53:57-07:00I am trying to batch edit my files and save them as their original names using the code:

Code: Select all

 magick convert *.tif -colorspace gray -threshold 50% -compress Group4 -set filename:f %t "%[filename:f].tif"
But, they are all saved under the first tif name as almost a pdf, with all of the image combined into the one. Any tips on how to remedy this?
For your use the best answer is probably snibgo's suggestion to use "mogrify". But if you need to use "magick", you can make sure the output images are separate and not combined into a multi-image TIF by using the plus "+" version of +adjoin.

I would generally put that "-set filename ..." right after reading in the images. Also, I'd put quotes around the "%t" in case any of the file names have spaces or special characters in them.

When using IM7 you should probably be using just "magick" instead of "magick convert". Adding "convert" will make the command behave as if it's IM version 6. That's not usually what you'll want.
Post Reply