Image类存储GPS信息

Image类存储GPS信息

本文介绍了使用GDI + Image类存储GPS信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Image的SetProperty函数将GPS信息存储到JPEG的EXIF元数据中.
在文档中,其内容为:
< SetPropertyItem 方法为此对象.如果该项目已经存在,则其内容将更新;否则,将更新其内容.否则,将添加一个新项目."

在我的情况下,我没有GPS信息,因此进行此调用应将新的元数据添加到文件中.

/> Weeelll并非如此.所有函数均返回OK,但未保存任何内容.我试图将其保存到另一个文件中,但该文件不起作用.
如果您有任何建议,请让我知道.

谢谢,

这是我存储纬度的条件:



Gdiplus :: Image * jpgImage = new Gdiplus :: Image(string_jpg_file);
    ;
double dLat = GetLatitude();

Gdiplus :: PropertyItem * propItem =新的Gdiplus :: PropertyItem;

propItem-> id = PropertyTagGpsLatitude;
propItem-> length = 3;
propItem-> type = PropertyTagTypeRational;
propItem-> value =(void *)& dLat;

jpgImage- > SetPropertyItem(propItem);
jpgImage-> Save(outFile,& encoder);


删除propItem;
删除jpgImage;

I'm trying to store GPS information to the JPEG's EXIF metadata using Image's SetProperty function.
In the documentation, it reads:
"The SetPropertyItem method sets a property item (piece of metadata) for this Image object. If the item already exists, then its contents are updated; otherwise, a new item is added."

In my case, I don't have the GPS information, thus making this call should add the new metadata to the file.

Weeelll it doesn't.  all the function returns Ok, but nothing is saved.  I tried to save it to another file, that didn't work.
If any of you have any suggestions, please let me know.

Thanks,

Here is what I have for storing latitude:



Gdiplus::Image* jpgImage = new Gdiplus::Image( string_jpg_file );
   
double dLat = GetLatitude();

Gdiplus::PropertyItem* propItem = new Gdiplus::PropertyItem;

propItem->id = PropertyTagGpsLatitude;
propItem->length = 3;
propItem->type = PropertyTagTypeRational;
propItem->value = (void*)&dLat;

jpgImage ->SetPropertyItem( propItem );
jpgImage ->Save( outFile, &encoder );


delete propItem;
delete jpgImage;

推荐答案


这篇关于使用GDI + Image类存储GPS信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 01:01