ExifTool Forum

ExifTool => Developers => Topic started by: Joanna Carter on July 22, 2023, 07:09:18 PM

Title: Read binary into data buffer
Post by: Joanna Carter on July 22, 2023, 07:09:18 PM
I am using Swift to call Exiftool via a command line.

Anyone any ideas how to read in the return from a call that includes -b and returns binary data into a memory buffer in Swift?
Title: Re: Read binary into data buffer
Post by: Phil Harvey on July 22, 2023, 08:43:18 PM
Simple.  Run ExifTool using the -stay_open option and with stdout tied to stdin in both directions.

Write your command arguments to from Swift to stdout, ending with -execute1234 (or whatever number you want).

Read stdin until you see "ready{1234}\n" (or whatever number you used) at the end of the output.  The binary data is everything before this response string (if you used the -b option).

- Phil