使用GDI + Image类存储GPS信息 [英] Using GDI+ Image class to store GPS information

查看:137
本文介绍了使用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;

推荐答案

替换‘ 3’与< sizeof(unsigned long)* 2 * 3 ’.代替 http://msdn.microsoft.com/zh-cn/library/ms534414(VS.85).aspx

Replace ‘3’ with ‘sizeof(unsigned long) * 2 * 3’. Instead of double write rational values according to documentation: http://msdn.microsoft.com/en-us/library/ms534416(VS.85).aspx, http://msdn.microsoft.com/en-us/library/ms534414(VS.85).aspx.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆