• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ image::AutoPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中exiv2::image::AutoPtr的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr类的具体用法?C++ AutoPtr怎么用?C++ AutoPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AutoPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: copyMetadata

void ExifTransfer::copyMetadata() {
    try {
        dst = Exiv2::ImageFactory::open(BasicIo::AutoPtr(new MemIo(data, dataSize)));
        dst->readMetadata();
    } catch (Exiv2::Error & e) {
        std::cerr << "Exiv2 error: " << e.what() << std::endl;
        return;
    }
    try {
        src = Exiv2::ImageFactory::open(srcFile.toLocal8Bit().constData());
        src->readMetadata();
        copyXMP();
        copyIPTC();
        copyEXIF();
    } catch (Exiv2::Error & e) {
        std::cerr << "Exiv2 error: " << e.what() << std::endl;
        // At least we have to set the SubImage1 file type to Primary Image
        dst->exifData()["Exif.SubImage1.NewSubfileType"] = 0;
    }
    try {
        dst->writeMetadata();
        FileIo fileIo(dstFile.toLocal8Bit().constData());
        fileIo.open("wb");
        fileIo.write(dst->io());
        fileIo.close();
    } catch (Exiv2::Error & e) {
        std::cerr << "Exiv2 error: " << e.what() << std::endl;
    }
}
开发者ID:Beep6581,项目名称:hdrmerge,代码行数:29,代码来源:ExifTransfer.cpp


示例2: write

void write(const std::string& file, Exiv2::ExifData& ed)
{
    Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
    assert (image.get() != 0);
    image->setExifData(ed);
    image->writeMetadata();
}
开发者ID:007durgesh219,项目名称:nomacs,代码行数:7,代码来源:exifdata-test.cpp


示例3: main

int main(int argc, char* const argv[])
try {

    if (argc != 2) {
        std::cout << "Usage: " << argv[0] << " file\n";
        return 1;
    }

    Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
    assert(image.get() != 0);
    image->readMetadata();

    const std::string& xmpPacket = image->xmpPacket();
    if (xmpPacket.empty()) {
        std::string error(argv[1]);
        error += ": No XMP packet found in the file";
        throw Exiv2::Error(1, error);
    }
    std::cout << xmpPacket << "\n";

    return 0;
}
catch (Exiv2::AnyError& e) {
    std::cout << "Caught Exiv2 exception '" << e << "'\n";
    return -1;
}
开发者ID:007durgesh219,项目名称:nomacs,代码行数:26,代码来源:xmpdump.cpp


示例4: populateMetaExif

int populateMetaExif(std::string file, std::string plate)
{
	try 
	{
		Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
		std::string comment = plate + ' '+ "LOT50"; //Add code to get information about lot
	
		if(!image.get())
		{
			throw Exiv2::Error(1, "Failed to open image");
		}
		
		image->readMetadata();
		Exiv2::ExifData &exifData = image->exifData();
	
		
		exifData["Exif.Photo.UserComment"]= comment;
		//std::cout<< "Writing Exiv User Comment "<< exifData["Exif.Image.ImageDescription"] <<"\n";
		image->writeMetadata();
		
	} catch (Exiv2::AnyError& e) {
		std::cout << "Problem Writing Metadata '" << e << "'\n";
		return -1;
	}
	
	return 0;
}
开发者ID:renegadeboss,项目名称:CyPRUSclient,代码行数:27,代码来源:cyprus_client.cpp


示例5: print

void print(const std::string& file)
{
    Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
    assert(image.get() != 0);
    image->readMetadata();

    Exiv2::ExifData &ed = image->exifData();
    Exiv2::ExifData::const_iterator end = ed.end();
    for (Exiv2::ExifData::const_iterator i = ed.begin(); i != end; ++i) {
        std::cout << std::setw(45) << std::setfill(' ') << std::left
                  << i->key() << " "
                  << "0x" << std::setw(4) << std::setfill('0') << std::right
                  << std::hex << i->tag() << " "
                  << std::setw(12) << std::setfill(' ') << std::left
                  << i->ifdName() << " "
                  << std::setw(9) << std::setfill(' ') << std::left
                  << i->typeName() << " "
                  << std::dec << std::setw(3)
                  << std::setfill(' ') << std::right
                  << i->count() << " "
                  << std::dec << i->value()
                  << "\n";

    }
}
开发者ID:FihlaTV,项目名称:Satires,代码行数:25,代码来源:write2-test.cpp


示例6: getExifFromPath

Exiv2::ExifData getExifFromPath(char* filename) {
    qDebug() << "Trying to read EXIF for" << filename;
    try {
        Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(filename);
        assert(image.get() != 0);
        image->readMetadata();

        Exiv2::ExifData &exifData = image->exifData();
        if (exifData.empty()) {
            std::string error(filename);
            error += ": No Exif data found in the file";

            //TODO Translate
            //throw Exiv2::Error(1, error);
        }
        return exifData;
    } catch (Exiv2::Error& e) {
        Exiv2::ExifData exifData;
        qCritical() << "Caught Exiv2 exception '" << e.what();
        //TODO Translate
        return exifData;
    }


}
开发者ID:shilpi230,项目名称:CaesiumPH,代码行数:25,代码来源:exif.cpp


示例7: imwrite_tiff

bool imwrite_tiff(matrix<unsigned short> output, string outputfilename,
                  Exiv2::ExifData exifData)
{
    int xsize, ysize;
    xsize = output.nc()/3;
    ysize = output.nr();



    outputfilename = outputfilename + ".tif";
    TIFF *out = TIFFOpen(outputfilename.c_str(),"w");
    if (!out)
    {
        cerr << "Can't open file for writing" << endl;
        return 1;
    }	
    TIFFSetField(out, TIFFTAG_IMAGEWIDTH, xsize);  
    TIFFSetField(out, TIFFTAG_IMAGELENGTH, ysize);
    TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 3); //RGB
    TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 16);
    TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);    // set the origin of the image.
    //Magic below
    TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
    TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
    //End Magic

    tsize_t linebytes = 3 * xsize * 2;//Size in bytes of a line
    unsigned short *buf = NULL;
    buf =(unsigned short *)_TIFFmalloc(linebytes);
    for (int j = 0; j < ysize; j++)
    {
        for(int i = 0; i < xsize; i ++)
        {
            buf[i*3  ] = output(j,i*3  );
            buf[i*3+1] = output(j,i*3+1);
            buf[i*3+2] = output(j,i*3+2);
        }
        if (TIFFWriteScanline(out, buf, j, 0) < 0)
            break;
    }
    (void) TIFFClose(out);

    if (buf)
        _TIFFfree(buf);

    exifData["Exif.Image.Orientation"] = 1;//set all images to unrotated
    exifData["Exif.Image.ImageWidth"] = output.nr();
    exifData["Exif.Image.ImageLength"] = output.nc()/3;

    Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(outputfilename.c_str());
    assert(image.get() != 0);

    image->setExifData(exifData);
    //image->writeMetadata();

    return 0;
}
开发者ID:CarVac,项目名称:filmulator-gui,代码行数:57,代码来源:imwriteTiff.cpp


示例8: loadFromData

bool JpegContent::loadFromData(const QByteArray& data)
{
    Exiv2::Image::AutoPtr image;
    Exiv2ImageLoader loader;
    if (!loader.load(data)) {
        qCritical() << "Could not load image with Exiv2, reported error:" << loader.errorMessage();
    }
    image = loader.popImage();

    return loadFromData(data, image.get());
}
开发者ID:KDE,项目名称:gwenview,代码行数:11,代码来源:jpegcontent.cpp


示例9: loadCamXyzFromDng

void RawParameters::loadCamXyzFromDng() {
    // Try to load it from the DNG metadata
    try {
        const float d65_white[3] = { 0.950456f, 1.0f, 1.088754f };
        double cc[4][4], xyz[] = { 1,1,1 };
        for (int i = 0; i < 4; ++i) {
            for (int j = 0; j < 4; ++j) {
                cc[j][i] = i == j ? 1.0 : 0.0;
            }
        }
        Exiv2::Image::AutoPtr src = Exiv2::ImageFactory::open(fileName.toLocal8Bit().constData());
        src->readMetadata();
        const Exiv2::ExifData & srcExif = src->exifData();

        auto ccData = srcExif.findKey(Exiv2::ExifKey("Exif.Image.CameraCalibration1"));
        if (ccData == srcExif.end()) {
            ccData = srcExif.findKey(Exiv2::ExifKey("Exif.Image.CameraCalibration2"));
        }
        if (ccData != srcExif.end()) {
            for (int i = 0; i < colors; ++i) {
                for (int j = 0; j < colors; ++j) {
                    cc[i][j] = ccData->toFloat(i*colors + j);
                }
            }
        }

        auto xyzData = srcExif.findKey(Exiv2::ExifKey("Exif.Image.AsShotWhiteXY"));
        if (xyzData != srcExif.end()) {
            xyz[0] = xyzData->toFloat(0);
            xyz[1] = xyzData->toFloat(1);
            xyz[2] = 1.0 - xyz[0] - xyz[1];
            for (int i = 0; i < 3; ++i) {
                xyz[i] /= d65_white[i];
            }
        }

        auto cmData = srcExif.findKey(Exiv2::ExifKey("Exif.Image.ColorMatrix1"));
        if (cmData == srcExif.end()) {
            cmData = srcExif.findKey(Exiv2::ExifKey("Exif.Image.ColorMatrix2"));
        }
        if (cmData != srcExif.end() && cmData->count() == 3*colors) {
            for (int c = 0; c < colors; ++c) {
                for (int i = 0; i < 3; ++i) {
                    camXyz[c][i] = 0.0;
                    for (int j = 0; j < colors; ++j) {
                        camXyz[c][i] += cc[c][j] * cmData->toFloat(j*3 + i) * xyz[i];
                    }
                }
            }
        }
    } catch (Exiv2::Error & e) {
        Log::debug("Could not load camXyz values from metadata: ", e.what());
    }
}
开发者ID:Beep6581,项目名称:hdrmerge,代码行数:54,代码来源:RawParameters.cpp


示例10: RemoveGPSExif

int RemoveGPSExif(const char* File, int NoChangeMtime)
{
	struct stat statbuf;
	struct stat statbuf2;
	struct utimbuf utb;
	if (NoChangeMtime)
		stat(File, &statbuf);

	// Open the file and start reading.
	Exiv2::Image::AutoPtr Image;
	
	try {
		Image = Exiv2::ImageFactory::open(File);
	} catch (Exiv2::Error e) {
		DEBUGLOG("Failed to open file %s.\n", File);
		return 0;
	}
	Image->readMetadata();
	if (Image.get() == NULL)
	{
		// It failed if we got here.
		DEBUGLOG("Failed to read file %s %s.\n",
			 File, Exiv2::strError().c_str());
		return 0;
	}

	Exiv2::ExifData &ExifInfo = Image->exifData();

	if (ExifInfo.count() == 0)
	{
		DEBUGLOG("No EXIF tags in file %s.\n", File);
		return 0;
	}

	EraseGpsTags(ExifInfo);
	
	try {
		Image->writeMetadata();
	} catch (Exiv2::Error e) {
		DEBUGLOG("Failed to write to file %s.\n", File);
		return 0;
	}

	if (NoChangeMtime)
	{
		stat(File, &statbuf2);
		utb.actime = statbuf2.st_atime;
		utb.modtime = statbuf.st_mtime;
		utime(File, &utb);
	}

	return 1;

}
开发者ID:bruniii,项目名称:gpscorrelate,代码行数:54,代码来源:exif-gps.cpp


示例11: save

void Frame::save(std::string dir) {
    std::string path = dir + "/" + id;
    imwrite(path, *img);
    Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
    image->readMetadata();
    Exiv2::ExifData &exifData = image->exifData();
    std::stringstream ss;
    ss << std::setprecision(12) << data.lat << " " << data.lon << " " << data.altitude << " " << data.heading << " " << data.time;
    exifData["Exif.Photo.UserComment"] = ss.str();
    image->writeMetadata();
}
开发者ID:chrishajduk84,项目名称:computer-vision,代码行数:11,代码来源:frame.cpp


示例12: ReadExifDate

char* ReadExifDate(const char* File, int* IncludesGPS)
{
	// Open and read the file.
	Exiv2::Image::AutoPtr Image;

	try {
		Image = Exiv2::ImageFactory::open(File);
	} catch (Exiv2::Error e) {
		DEBUGLOG("Failed to open file %s.\n", File);
		return NULL;
	}
	Image->readMetadata();
	if (Image.get() == NULL)
	{
		DEBUGLOG("Failed to read file %s %s.\n",
			 File, Exiv2::strError().c_str());
		return NULL;
	}

	Exiv2::ExifData &ExifRead = Image->exifData();

	// Read the tag out.
	Exiv2::Exifdatum& Tag = ExifRead["Exif.Photo.DateTimeOriginal"];

	// Check that the tag is not blank.
	std::string Value = Tag.toString();

	if (Value.length() == 0)
	{
		// No date/time stamp.
		// Not good.
		// Just return - above us will handle it.
		return NULL;
	}

	// Copy the tag and return that.
	char* Copy = strdup(Value.c_str());
	
	// Check if we have GPS tags.
	Exiv2::Exifdatum& GPSData = ExifRead["Exif.GPSInfo.GPSLatitude"];

	if (GPSData.count() < 3)
	{
		// No valid GPS data.
		*IncludesGPS = 0;
	} else {
		// Seems to include GPS data...
		*IncludesGPS = 1;
	}

	// Now return, passing a pointer to the date string.
	return Copy; // It's up to the caller to free this.
}
开发者ID:bruniii,项目名称:gpscorrelate,代码行数:53,代码来源:exif-gps.cpp


示例13: catch

// Reads metadata from given file
Exiv2::ExifData *FlickrDownload::readExifData(QString file){
    try{
        Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(
                    file.toStdString().c_str());
        image->readMetadata();
        Exiv2::ExifData *data = new Exiv2::ExifData();
        *data = image->exifData();
        return data;
    } catch (Exiv2::Error& e) {
        qCritical("[Filechooser] %s", e.what());
        return 0;
    }
}
开发者ID:FalseCAM,项目名称:reihenaufnahme,代码行数:14,代码来源:flickr-download.cpp


示例14: createProcessor

NegativeProcessor* NegativeProcessor::createProcessor(AutoPtr<dng_host> &host, const char *filename) {
    // -----------------------------------------------------------------------------------------
    // Open and parse rawfile with libraw...

    AutoPtr<LibRaw> rawProcessor(new LibRaw());

    int ret = rawProcessor->open_file(filename);
    if (ret != LIBRAW_SUCCESS) {
        rawProcessor->recycle();
        std::stringstream error; error << "LibRaw-error while opening rawFile: " << libraw_strerror(ret);
        throw std::runtime_error(error.str());
    }

    ret = rawProcessor->unpack();
    if (ret != LIBRAW_SUCCESS) {
        rawProcessor->recycle();
        std::stringstream error; error << "LibRaw-error while unpacking rawFile: " << libraw_strerror(ret);
        throw std::runtime_error(error.str());
    }

    // -----------------------------------------------------------------------------------------
    // ...and libexiv2

    Exiv2::Image::AutoPtr rawImage;
    try {
        rawImage = Exiv2::ImageFactory::open(filename);
        rawImage->readMetadata();
    } 
    catch (Exiv2::Error& e) {
        std::stringstream error; error << "Exiv2-error while opening/parsing rawFile (code " << e.code() << "): " << e.what();
        throw std::runtime_error(error.str());
    }

    // -----------------------------------------------------------------------------------------
    // Identify and create correct processor class

    if (rawProcessor->imgdata.idata.dng_version != 0) {
        try {return new DNGprocessor(host, rawProcessor.Release(), rawImage);}
        catch (dng_exception &e) {
            std::stringstream error; error << "Cannot parse source DNG-file (code " << e.ErrorCode() << ")";
            throw std::runtime_error(error.str());
        }
    }
    else if (!strcmp(rawProcessor->imgdata.idata.model, "ILCE-7"))
        return new ILCE7processor(host, rawProcessor.Release(), rawImage);
    else if (!strcmp(rawProcessor->imgdata.idata.make, "FUJIFILM"))
        return new FujiProcessor(host, rawProcessor.Release(), rawImage);

    return new VariousVendorProcessor(host, rawProcessor.Release(), rawImage);
}
开发者ID:elix22,项目名称:raw2dng,代码行数:50,代码来源:negativeProcessor.cpp


示例15: HashExif

bool ExifHasher::HashExif(const std::string& path,
                          unsigned char* sha1_hash) const {
  FD fd;
  sys_call_rv(fd, open, path.c_str(), O_RDONLY);
  struct stat stat_buf;
  sys_call(fstat, fd, &stat_buf);
  void* memblock;
  sys_call2_rv(NULL, memblock, mmap, NULL, stat_buf.st_size, PROT_READ,
               MAP_PRIVATE, fd, 0);
  auto bytes = static_cast<const unsigned char*>(memblock);

  Exiv2::Image::AutoPtr image;
  try {
    image = Exiv2::ImageFactory::open(bytes, stat_buf.st_size);
  } catch (const std::exception& e) {
    std::cerr << "Error: " << e.what() << std::endl;
    return false;
  }

  if (image.get() != 0)
    image->readMetadata();
  else
    std::cerr << "Warning: EXIF not found in: " << path << std::endl;

  sys_call(munmap, memblock, stat_buf.st_size);
  fd.Close();

  if (image.get() == 0)
    return false;

  const auto& exifData = image->exifData();
  if (!exifData.empty()) {
    std::ostringstream oss;
    auto end = exifData.end();
    for (auto i = exifData.begin(); i != end; ++i) {
      // std::cerr << i->key() << " (" << i->count() << ")" << ": " <<
      //     i->value() << std::endl;
      oss << i->key() << i->value();
    }
    const std::string& exif_str = oss.str();
    SHA1(reinterpret_cast<const unsigned char*>(exif_str.c_str()),
         exif_str.size(), sha1_hash);
    return true;
  } else {
    std::cerr << "Warning: EXIF not found in: " << path << std::endl;
  }

  return false;
}
开发者ID:losvald,项目名称:jpgsync,代码行数:49,代码来源:exif_hasher.cpp


示例16: saveExifData

// Saves Exifdata to given file
void FlickrUpload::saveExifData(Exiv2::ExifData *exifData, QByteArray *image){
    try {
        Exiv2::Image::AutoPtr destImage = Exiv2::ImageFactory::open(
                    (Exiv2::byte*)image->constData(), (long)image->size());
        destImage->setExifData(*exifData);
        destImage->writeMetadata();
        // get updated image data
        Exiv2::BasicIo&  rawio = destImage->io();
        Exiv2::DataBuf  dbuf = rawio.read( rawio.size() );
        image->clear();
        image->append(QByteArray::fromRawData((char*)dbuf.pData_, dbuf.size_));
    } catch (Exiv2::Error& e) {
        qCritical("[SaveFile] %s", e.what());
    }
}
开发者ID:FalseCAM,项目名称:reihenaufnahme,代码行数:16,代码来源:flickr-upload.cpp


示例17: saveImage

void ImageView::saveImage()
{
	Exiv2::Image::AutoPtr image;
	bool exifError = false;

	if (newImage)
	{
		saveImageAs();
		return;
	}

	setFeedback(tr("Saving..."));

	try
	{
		image = Exiv2::ImageFactory::open(currentImageFullPath.toStdString());
		image->readMetadata();
	}
	catch (Exiv2::Error &error)
	{
		exifError = true;
	}

	QImageReader imgReader(currentImageFullPath);
	if (!displayPixmap.save(currentImageFullPath, imgReader.format().toUpper(),
																			GData::defaultSaveQuality))
	{
		QMessageBox msgBox;
		msgBox.critical(this, tr("Error"), tr("Failed to save image."));
		return;
	}

	if (!exifError)
	{
		try
		{
			image->writeMetadata();
		}
		catch (Exiv2::Error &error)
		{
			QMessageBox msgBox;
			msgBox.critical(this, tr("Error"), tr("Failed to save Exif metadata."));
		}
	}

	reload();
	setFeedback(tr("Image saved."));
}
开发者ID:vfrenkel,项目名称:phototonic,代码行数:48,代码来源:imageview.cpp


示例18: showExifData

// uses the exiv2 class to readout the exifdata from images
int ExifScout::showExifData(std::string a){
    try {
        Ui_MainWindow::textEdit->clear();
        std::cerr << "ImageFactory::open ";
        Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(a);
        std::cerr << "DONE\n";
        assert(image.get() != 0);

        std::cerr << "image->readMetadata() ";
        image->readMetadata();
        std::cerr << "DONE\n";

        std::cerr << "Exiv2::ExifData& exifData = image->exifData() ";
        Exiv2::ExifData exifData = image->exifData();
        std::cerr << "DONE\n";

	cout << "Number of found exiv2 data: " << exifData.count() << endl;
        if (exifData.empty()) {
            Ui_MainWindow::textEdit->setPlainText("No Exif data found in file");
            return 1;
        }

        Exiv2::ExifData::const_iterator end = exifData.end();
        std::cerr << "Generate the exif-output ";
        QString output;
        for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
            std::string tagname = i->tagName();

            if(tagname != std::string("MakerNote") and
               tagname.substr(0,2) != "0x"){
                // Print out the exif-data in the QtextEdit Field
                std::ostringstream oss;
                oss << i->tagName() << ":\n    " << i->value() << "\n";
                output = output+(QString)oss.str().c_str();
            }
        }
        std::cerr << "Done\n";
        Ui_MainWindow::textEdit->setPlainText(output);

        return 0;
    }
    //catch (std::exception& e) {
    //catch (Exiv2::AnyError& e) {
    catch (Exiv2::Error& e) {
        std::cout << "Caught Exiv2 exception '" << e.what() << "'\n";
        return -1;
    }
}
开发者ID:hypergnash,项目名称:Exif-Scout,代码行数:49,代码来源:exif-scout_window.cpp


示例19: updateExifInfo

void ThumbView::updateExifInfo(QString imageFullPath)
{
	Exiv2::Image::AutoPtr exifImage;
	QString key;
	QString val;

	try	{
		exifImage = Exiv2::ImageFactory::open(imageFullPath.toStdString());
		exifImage->readMetadata();
	}
	catch (Exiv2::Error &error) {
		return;
	}

	Exiv2::ExifData &exifData = exifImage->exifData();
	if (!exifData.empty()) {
		Exiv2::ExifData::const_iterator end = exifData.end();
		infoView->addTitleEntry("Exif");
		for (Exiv2::ExifData::const_iterator md = exifData.begin(); md != end; ++md) {
			key = QString::fromUtf8(md->tagName().c_str());
			val = QString::fromUtf8(md->print().c_str());
			infoView->addEntry(key, val);
		}
	}

	Exiv2::IptcData &iptcData = exifImage->iptcData();
	if (!iptcData.empty()) {
		Exiv2::IptcData::iterator end = iptcData.end();
		infoView->addTitleEntry("IPTC");
		for (Exiv2::IptcData::iterator md = iptcData.begin(); md != end; ++md) {
			key = QString::fromUtf8(md->tagName().c_str());
			val = QString::fromUtf8(md->print().c_str());
	   		infoView->addEntry(key, val);
		}
	}

	Exiv2::XmpData &xmpData = exifImage->xmpData();
	if (!xmpData.empty()) {
		Exiv2::XmpData::iterator end = xmpData.end();
		infoView->addTitleEntry("XMP");
		for (Exiv2::XmpData::iterator md = xmpData.begin(); md != end; ++md) {
			key = QString::fromUtf8(md->tagName().c_str());
			val = QString::fromUtf8(md->print().c_str());
			infoView->addEntry(key, val);
		}
	}
}
开发者ID:JHooverman,项目名称:phototonic,代码行数:47,代码来源:thumbview.cpp


示例20: main

// *****************************************************************************
// Main
int main(int argc, char* const argv[])
try {

    if (argc != 2) {
        std::cout << "Usage: " << argv[0] << " file\n";
        return 1;
    }

    Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
    assert (image.get() != 0);
    image->readMetadata();
    Exiv2::ExifData &exifData = image->exifData();

    /*
      Exiv2 uses a CommentValue for Exif user comments. The format of the
      comment string includes an optional charset specification at the beginning:

      [charset=["]Ascii|Jis|Unicode|Undefined["] ]comment

      Undefined is used as a default if the comment doesn't start with a charset
      definition.

      Following are a few examples of valid comments. The last one is written to
      the file.
     */
    exifData["Exif.Photo.UserComment"]
        = "charset=\"Unicode\" An Unicode Exif comment added with Exiv2";
    exifData["Exif.Photo.UserComment"]
        = "charset=\"Undefined\" An undefined Exif comment added with Exiv2";
    exifData["Exif.Photo.UserComment"]
        = "Another undefined Exif comment added with Exiv2";
    exifData["Exif.Photo.UserComment"]
        = "charset=Ascii An ASCII Exif comment added with Exiv2";

    std::cout << "Writing user comment '"
              << exifData["Exif.Photo.UserComment"]
              << "' back to the image\n";

    image->writeMetadata();

    return 0;
}
catch (Exiv2::AnyError& e) {
    std::cout << "Caught Exiv2 exception '" << e << "'\n";
    return -1;
}
开发者ID:obklar,项目名称:exiv2,代码行数:48,代码来源:exifcomment.cpp



注:本文中的exiv2::image::AutoPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ iptcdata::iterator类代码示例发布时间:2022-05-31
下一篇:
C++ exifdata::iterator类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap