How to get image's info through the starting the app?

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
olleksa
Posts: 1
Joined: 2019-04-11T00:59:51-07:00
Authentication code: 1152

How to get image's info through the starting the app?

Post by olleksa »

I have a working code:
StartApp(C:\ImageMagick\magick.exe composite -geometry +1358+403 "84114к.png" "841v8_3961_17.jpg" "841v8_3961_17.jpg")

It works like command line:
start C:\ImageMagick\magick.exe composite -geometry +1358+403 "84114к.png" "841v8_3961_17.jpg" "841v8_3961_17.jpg"

But now I have to get an information about image to the info.txt. I am trying to write something like this:
start C:\ImageMagick\magick.exe -format "%wx%h" >d:\info.txt d:\Image.jpg
The file d:\info.txt is overwritten, but there is no data.

Could anybody help me?

P.s. ImageMagick-7.0.7-Q16
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: How to get image's info through the starting the app?

Post by GeeMack »

olleksa wrote: 2019-04-11T01:23:02-07:00But now I have to get an information about image to the info.txt. I am trying to write something like this:
start C:\ImageMagick\magick.exe -format "%wx%h" >d:\info.txt d:\Image.jpg
The file d:\info.txt is overwritten, but there is no data.
With IM version 7 you need to put the input image near the beginning of your command so the command can read the image first, then do the various operations on it. Also, to output the information from "-format" you need to write it to the proprietary file format "info:". Try a command more like this...

Code: Select all

magick input.png -format "%wx%h" info: > d:\info.txt
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to get image's info through the starting the app?

Post by snibgo »

As GeeMack says. Putting a redirection ">" in the middle of a command doesn't work.

GeeMacks solution can be simplified slightly, by writing directly to the text file:

Code: Select all

magick input.png -format "%wx%h" info:d:\info.txt
snibgo's IM pages: im.snibgo.com
Post Reply