Page 1 of 1

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

Posted: 2019-04-11T01:23:02-07:00
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

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

Posted: 2019-04-11T07:49:19-07:00
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

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

Posted: 2019-04-11T08:28:57-07:00
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