We have some assets in shotgun that are being queried and displayed in a pyside gui. I was wondering if there is a way to query a higher quality thumbnail from the sg field ‘image’ It appears to be a very small compressed image. Are there other versions of the thumbnail I can query or is there a way i can query the original thumbnail (most ideal). That would be most ideal.
Yes, and no. It all depends how the thumbnail originated. If you upload a high res image directly to the thumbnail field, then you can access it directly using this URL format:
Note, you need to be authenticated for that URL to resolve. If, however, the thumbnail was automatically generated (think the thumbnail field on a Version), then it will just have the lower res output that was created as part of the transcoding process.
Hey Brandon,
I was looking at using what you suggested but it appears to return a unusable result. My goal was to get the full url path to the original uploaded image. I’m not quite sure what it is returning at the moment, however it doesn’t appear to be the url to the image. Is there a way to do that?
Below is my updated snippet. You’ll notice it opens the low res thumbnail in the browser. My goal is to have it open the original raw one in the browser as well, or at least return the url for it more importantly.
def getFullRawThumbnail():
entityType = 'CustomNonProjectEntity08'
entityID = 423
filters = [['id', 'is', entityID]]
fields = ['code', 'image', 'sg_type']
result = sg.find_one(entityType, filters, fields)
os.startfile(result['image'])
result = sg.download_attachment({'url':'https://******.shotgunstudio.com/thumbnail/full/{}/{}'.format(entityType, entityID)})
print result
os.startfile(result)
if __name__ == '__main__':
getFullRawThumbnail()
What sort of result are you getting? If you’re not supplying a file_path as part of the download_attachment() call, then it’s returning the actual data of the file itself.
I’m not sure how os.startfile() interacts with a raw file stream. If you first save the file locally and then try to open it, how does that work for you?
I know this is an old thread, this is still an issue for me. There seems to be discrepancies between the Shotgun site, the REST API, and the Python API in regards to thumbnails.
I’m simply trying to download thumbnails for any given entity. On the Shotgrid site, Versions have their own thumbnails which are automatically generated from uploaded .mov files. Shots have thumbnails displayed based on a query (generally most recent Version).
When downloading Version thumbnails, I get the following results:
Python API, reading the Version entity[‘image’] field:
A signed s3 link to the low-res thumbnail (480x270)
Shotgun HTTP site, using https://{site}/thumbnail/Version/{id}/
Redirect to s3 link for the low-res thumbnail (480x270)
Shotgun HTTP site, using https://{site}/thumbnail/full/Version/{id}/
Redirect to s3 link for a full res thumbnail at the original .mov resolution
Shotgun REST API, using /api/v1/entity/Version/{id}/image?alt={size}
Low-res if size=“thumbnail”, full-res if size=“original”
However, when downloading Shot thumbnails
Python API, reading the Shot entity[‘image’] field:
A signed s3 link to the low-res Version thumbnail (480x270)
Shotgun HTTP site, using https://{site}/thumbnail/Shot/{id}/
404 not found
Shotgun HTTP site, using https://{site}/thumbnail/full/Shot/{id}/
404 not found
Shotgun REST API, using /api/v1/entity/Version/{id}/image?alt={size}
404 not found for either original or thumbnail size
So it seems using the Python API actually follows the Shot thumbnail query and returns the correct thumbnail link, but only at low res (480x270). The REST API does not and returns 404.
But what I really need is a way to get the queried thumbnail for a shot at full res.
Is there any way to do this using any of the APIs?
For anyone else with the same issues, turns out there’s an “image_source_entity” field that is exactly what I needed. It’s accessible as an entity field via the Python api or as a relationships/image_source_entity object from the REST API and it returns the thumbnail source entity for any other given entity.
Then you can grab the full res thumbnail for the image_source_entity via the REST API or directly via http.
Note the image_source_entity field doesn’t seem to be mentioned in either the python or REST api documentation, though I did find a brief explanation of it here.