1

I want to translate the following exiftool command to an Exiftool C++ code:

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

So far I have written the following:

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

Therefore, I am just left with the > imageOut.png part.
But I am not able to figure out how to translate this.
Can someone guide me towards this. Thanks.

Tree Big
  • 113
  • 9
  • Try `GetOutput()` to get the result as string and write its content to file: https://exiftool.org/cpp_exiftool/#GetOutput – leosh Mar 31 '22 at 07:04
  • Oh, my bad, there is a c++ wrapper for Exiftool. Good catch. – David C. Rankin Mar 31 '22 at 07:18
  • @leosh Thank you. I will be able to get the content in 'information' through `imageIn->GetOutput()`. But how do I create a PNG file from that? – Tree Big Mar 31 '22 at 07:55
  • Actually, I just realized that `agInfo* information = imageIn->ImageInfo(imageIn.jpg, "-RawThermalImage -b")` doesn't work. I get the error saying -RawThermalImage is an invalid tag. Do you know how I can access the rawthermal values? – Tree Big Mar 31 '22 at 10:06
  • The `RawThermalImage` will either be stored as raw data or as a PNG in the file. If it is raw data, then exiftool will make it into a tiff upon extraction. If it's a PNG, then exiftool will extract it as is. You can check `RawThermalImageType` to see which. See [FLIR RawData Tags](https://exiftool.org/TagNames/FLIR.html#RawData). – StarGeek Mar 31 '22 at 15:54
  • Also, make sure you read the [`ImageInfo` inputs section](https://exiftool.org/cpp_exiftool/#ImageInfo) carefully. I believe that your actual error is `-RawThermalImage -b` (space included) doesn't exist, not `-RawThermalImage` doesn't exist. You need a new line between `-RawThermalImage` and `-b`. – StarGeek Mar 31 '22 at 15:54

0 Answers0