Translate an Exiftool command to Exiftool in C++

Mar 31, 2022 at 9:20am
I want to translate an Exfitool terminal command to the Exiftool C++ wrapper code.

The command is as follows:

exiftool -RawThermalImage -b imageIn.jpg > imageOut.png


I have written the following code so far:

1
2
ExifTool* imageIn = new ExifTool();
TagInfo* information = imageIn->ImageInfo(imageIn.jpg, "-RawThermalImage -b");


But I am not able to understand, how I can translate the > imageOut.png part. Kindly guide.
Thanks.
Last edited on Mar 31, 2022 at 9:21am
Mar 31, 2022 at 9:27am
But I am not able to understand, how I can translate the > imageOut.png part. Kindly guide.

This part of the command simple tells the shell to redirect the stdout of the exiftool program to a file.

Inside your own C/C++ program, you can simple use a combination of fopen() and fwrite() to write the output to whichever file that you desire. Your program may take the name of the output file as a command-line parameter, if you don't want to "hard-code" the file name. Well, either that, or write the output to stdout (by using fwrite(stdout, ...)) and let the caller of your program redirect the output to the desired file....
Last edited on Mar 31, 2022 at 9:30am
Mar 31, 2022 at 11:13am
Topic archived. No new replies allowed.