Images Service + faulty images / incorrect dimensions + best way to determine image dimensions

53 views
Skip to first unread message

Kaan Soral

unread,
Jun 23, 2014, 6:24:46 PM6/23/14
to google-a...@googlegroups.com
I'm currently using this method

       
try:
            data
= blobstore.fetch_data(blob_key, 0, 50000)
            img
=images.Image(image_data=data)
            size
.width=img.width; size.height=img.height
       
except:
            logging
.info("Image Error routine of getImageSize")
            img
=images.Image(blob_key=blob_key)
            img
.im_feeling_lucky()
            img
.execute_transforms(output_encoding=images.JPEG,parse_source_metadata=True)
            size
.width=img.width; size.height=img.height
           
try: size.metadata=img.get_original_metadata()
           
except: pass
I've noticed the first routine failed for some images, that's why I've implemented the second routine, I was hoping it was the last frontier, it wasn't

Recently I've noticed another faulty image in my service, the dimensions seem to be reversed (width <-> height), I haven't inspected the image in detail yet

What's the best way to determine dimensions of an image? It feels like I'm missing an obvious solution here

Kaan Soral

unread,
Jun 26, 2014, 2:12:56 PM6/26/14
to google-a...@googlegroups.com
Digged deeper and reported this issue

https://code.google.com/p/googleappengine/issues/detail?id=11067

I think the images.Image and the included features should be improved with JPEG/EXIF in mind

There should be a method that simply gets metadata/dimensions, without the need for pseudo transformations just to force their computation
Reply all
Reply to author
Forward
0 new messages