def get_image_json(image):
 preview_image = image.get_rendition(u'max-165x165')
 return json.dumps({u'id': image.id, u'edit_link': reverse(u'wagtailimages:edit', args=(image.id,)), u'title': image.title, u'preview': {u'url': preview_image.url, u'width': preview_image.width, u'height': preview_image.height}})

def get_image_json ( image ) : preview_image = image . get_rendition ( u'max-165x165' ) return json . dumps ( { u'id' : image . id , u'edit_link' : reverse ( u'wagtailimages:edit' , args = ( image . id , ) ) , u'title' : image . title , u'preview' : { u'url' : preview_image . url , u'width' : preview_image . width , u'height' : preview_image . height } } )
helper function: given an image .