本文整理汇总了C++中image::AutoPtr::iptcData方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr::iptcData方法的具体用法?C++ AutoPtr::iptcData怎么用?C++ AutoPtr::iptcData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image::AutoPtr
的用法示例。
在下文中一共展示了AutoPtr::iptcData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// *****************************************************************************
// Main
int main(int argc, char* const argv[])
{
try {
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " image\n";
std::cout << "Commands read from stdin.\n";
return 1;
}
Image::AutoPtr image = ImageFactory::open(argv[1]);
assert (image.get() != 0);
image->readMetadata();
// Process commands
std::string line;
int num = 0;
std::getline(std::cin, line);
while (line.length() && processLine(line, ++num, image->iptcData())) {
std::getline(std::cin, line);
}
// Save any changes
image->writeMetadata();
return 0;
}
catch (AnyError& e) {
std::cout << "Caught Exiv2 exception '" << e << "'\n";
return -1;
}
}
示例2: readMetadata
void PgfImage::readMetadata()
{
#ifdef DEBUG
std::cerr << "Exiv2::PgfImage::readMetadata: Reading PGF file " << io_->path() << "\n";
#endif
if (io_->open() != 0)
{
throw Error(9, io_->path(), strError());
}
IoCloser closer(*io_);
// Ensure that this is the correct image type
if (!isPgfType(*io_, true))
{
if (io_->error() || io_->eof()) throw Error(14);
throw Error(3, "PGF");
}
clearMetadata();
readPgfMagicNumber(*io_);
uint32_t headerSize = readPgfHeaderSize(*io_);
readPgfHeaderStructure(*io_, &pixelWidth_, &pixelHeight_);
// And now, the most interresting, the user data byte array where metadata are stored as small image.
long size = 8 + headerSize - io_->tell();
#ifdef DEBUG
std::cout << "Exiv2::PgfImage::readMetadata: Found Image data (" << size << " bytes)\n";
#endif
if (size < 0) throw Error(20);
if (size == 0) return;
DataBuf imgData(size);
std::memset(imgData.pData_, 0x0, imgData.size_);
long bufRead = io_->read(imgData.pData_, imgData.size_);
if (io_->error()) throw Error(14);
if (bufRead != imgData.size_) throw Error(20);
Image::AutoPtr image = Exiv2::ImageFactory::open(imgData.pData_, imgData.size_);
image->readMetadata();
exifData() = image->exifData();
iptcData() = image->iptcData();
xmpData() = image->xmpData();
} // PgfImage::readMetadata
示例3: read
int IptcData::read(const std::string& path)
{
if (!fileExists(path, true)) return -1;
Image::AutoPtr image = ImageFactory::instance().open(path);
if (image.get() == 0) {
// We don't know this type of file
return -2;
}
int rc = image->readMetadata();
if (rc == 0) {
if (image->sizeIptcData() > 0) {
rc = read(image->iptcData(), image->sizeIptcData());
}
else {
rc = 3;
}
}
return rc;
}