2012-06-27 12 views
5

Google ऐप इंजन देव पर्यावरण में मुझे एक्ज़िफ़ डेटा नहीं मिल सकता है। मैं कोडGoogle ऐप इंजन में छवि exif डेटा

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

मैं केवल कोई नहीं मिल में निम्नलिखित यहां https://developers.google.com/appengine/docs/python/images/imageclass

मैंने किया है से गाइड का पालन किया। आईएमजी ऑब्जेक्ट ठीक है क्योंकि मैं img.resize आदि कर सकता हूं। मुझे Exif जानकारी प्राप्त करने की आवश्यकता है।

अद्यतन: यह मैं मेटाडाटा प्राप्त करने में सक्षम था, ऐसा करने से

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

तरह दस्तावेज में विस्तार से बताया मैं बहुत 'सीमित' अधिक सटीक जाहिर सेट इस

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

आप ज्यादा पाने मिला असली माहौल में बड़ा सेट, मुझे नहीं पता कि यह देव env की विशेषता क्यों नहीं हो सकती है। यह काफी निराशाजनक है। जब तक मैं pyexiv2 स्तर exif प्राप्त कर सकता हूं मैं ठीक हूँ लेकिन अगर यह सिर्फ पीआईएल का उपयोग कर रहा है जो पर्याप्त नहीं है। वर्तमान में पीआईएल रास्ता बहुत कम जानकारी प्रदान करता है।

उत्तर

3

देव पर्यावरण पीआईएल का उपयोग करता है जो बताता है कि आप क्या देखते हैं। उत्पादन वातावरण पीआईएल का उपयोग नहीं करता है और आपको छवि में मौजूद अधिकांश टैग देगा।

+0

तो यह उत्पादन में जनहित याचिका का उपयोग नहीं करता था, एक राहत thats। EXIF पढ़ने के मामले में पीआईएल गंभीरता से उड़ाता है। – specialscope

0

के लिए get_original_metadata

 
Returns: 
    dict with string keys. If execute_transform was called with parse_metadata 
    being True, this dictionary contains information about various properties 
    of the original image, such as dimensions, color profile, and properties 
    from EXIF. 
    Even if parse_metadata was False or the images did not have any metadata, 
    the dictionary will contain a limited set of metadata, at least 
    'ImageWidth' and 'ImageLength', corresponding to the dimensions of the 
    original image. 
    It will return None, if it is called before a successful 
    execute_transfrom. 

आप EXIF ​​डेटा सहित अधिक मेटाडेटा प्राप्त करने के क्रम में execute_transform को parse_metadata=True पास करना चाहते हैं डॉक्स से लिया।

यह भी None लौटने के बारे में नीचे टिप्पणी बताता है कि क्यों आप क्रम में execute_transforms कॉल करने के लिए कुछ भी पाने के लिए वापस