Output data to text files etc.

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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Output data to text files etc.

Post by Bonzo »

I am trying to get some image data into a php variable with success in some cases and not in others.

Please can somebody explain where the info will be going when using :- and 2>&1
What would I need to write the data to a text file?

Looking on the web I only need the stdout and not the error?

Code: Select all

magick -ping image.CR2 XMP:-

This works in the command line and I get a list of the XMP data.

Also with one of my tests ( I can not remember which one now ) in php I had the last line of the file <?xpacket end="w"?> Thinking about it I had a similar problem doing something and each line of the data was overwriting the previous one. Although that could have been when I was working on some Pi code as I have been trying that out lately as well.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Output data to text files etc.

Post by snibgo »

Bonzo wrote:Please can somebody explain where the info will be going when using :- and 2>&1

What would I need to write the data to a text file?
XMP:- will send the XMP text data to stdout.

If you also have 2>&1 then any text that would be sent to stderr will instead go to stdout.

If you want the XMP text data to go to a file instead of stdout, use a filename instead of the minus, eg XMP:myfile.txt

An alternative is to use >myfile.txt , but this will redirect all of stdout to the file, not just the XMP data.
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Output data to text files etc.

Post by Bonzo »

Thank you for the information snibgo
Post Reply