- Documentation
Torch Object Storage
SDK Reference
C++
Data Processing
Image Processing
Retrieving Image Information (C++ SDK)
Image Processing
Retrieving Image Information (C++ SDK)
Retrieving Image Information (C++ SDK)
The image information retrieval function provides access to the basic attributes of an image, including its height, width, size, and format. If the image contains Exif information, the content will be returned in JSON format. This article describes how to obtain image information using the TOS C++ SDK.
Sample Code
The following code demonstrates how to retrieve image information.
#include "TosClientV2.h"
using namespace VolcengineTos;
std::string region = "Your Region";
std::string accessKey = std::getenv("TOS_ACCESS_KEY");
std::string secretKey = std::getenv("TOS_SECRET_KEY");
std::string bucketName = "examplebucket";
std::string objectName = "exampledir/exampleobject.jpg";
TosClientV2 client(region, accessKey, secretKey);
GetObjectV2Input input(bucketName, objectName);
std::string style = "image/info";
input.setProcess(style);
auto output = client.getObject(input);
if (!output.isSuccess()) {
std::cout << "GetObjectToFile failed." << output.error().String() << std::endl;
ss << output.result().getContent()->rdbuf();
std::string infoJson = ss.str();
Relevant Documentation
Last updated: 2025.09.25 14:22:48