Google应用引擎中的图像exif数据 [英] Image exif data in google app engine

查看:70
本文介绍了Google应用引擎中的图像exif数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在谷歌应用程序引擎开发环境中,我无法获取exif数据。我遵循此处的指南
https://developers.google.com/appengine/docs/python / images / imageclass



我在代码中完成了以下操作:

  def getResizedImage(self,image,imagemaxWidth,imagemaxHeight):
img = images.Image(image_data = image)
logging.error(img.get_original_metadata())

我只得到None。
img对象很好,因为我可以执行img.resize等。我需要获取Exif信息。



更新:通过这样做,我被能够获取元数据,
$ b

  def getResizedImage(self,image,imagemaxWidth,imagemaxHeight):
img = images.Image(image_data = image)
img.rotate(0)
img.execute_transforms()
logging.error(img.get_original_metadata())


$ b

像文档中解释的那样,我得到了非常'有限'的设置。 $ p $ {u'ImageLength':480,u'ImageWidth':640}



显然你在真实环境中获得了更大的设置,但我不知道为什么这个不能成为开发环境的特征。这很令人沮丧。只要我能得到pyexiv2级别的exif,我没关系,但如果它只是使用PIL,那就不够好。目前PIL提供了一些exif信息。

解决方案

开发环境使用PIL解释您所看到的内容。生产环境不使用PIL,并会为您提供图像中大部分标签。


In google app engine dev environment I cannot get exif data. I followed guide from here https://developers.google.com/appengine/docs/python/images/imageclass

I have done following in the code

def getResizedImage(self, image, imagemaxWidth, imagemaxHeight):
    img = images.Image(image_data=image)
    logging.error(img.get_original_metadata())

I only get None. the img object is fine as I can perform img.resize etc. I need to get Exif info.

UPDATE: By doing this I was able to get metadata,

def getResizedImage(self, image, imagemaxWidth, imagemaxHeight):
    img = images.Image(image_data=image)
    img.rotate(0)
    img.execute_transforms()
    logging.error(img.get_original_metadata())

Like explained in documentation I got very 'limited' set more precisely this

{u'ImageLength': 480, u'ImageWidth': 640}

Apparently you get much bigger set in real environment, I have no idea why this cant be the feature of dev env though. It is quite frustrating. As long as I can get pyexiv2 level exif I am okay but if it is just using PIL that is not good enough. Currently PIL provides way little exif information.

解决方案

The dev environment uses PIL which explains what you see. The production environment does not use PIL and will give you the majority of the tags that are in the image.

这篇关于Google应用引擎中的图像exif数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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