Closed GeekTrainer closed 4 years ago
@GeekTrainer Thanks for the feedback! We are currently investigating and will update you shortly.
@GeekTrainer A sample is available for this call on the SDK page of github here.
from PIL import Image
import io
width = 50
height = 50
url = "http://www.public-domain-photos.com/free-stock-photos-4/travel/san-francisco/golden-gate-bridge-in-san-francisco.jpg"
thumbnail = client.generate_thumbnail(width, height, url)
for x in thumbnail:
image = Image.open(io.BytesIO(x))
image.save('thumbnail.jpg')
@PatrickFarley can we include this sample in the documentation for future updates of this page?
Unfortunately the samples site isn't easily discoverable. I spent a good two hours searching through the docs, Bing and Google, before finally finding a Stack Overflow page which gave me a hint as to how to work with it.
# Avoiding using PIL
thumbnail = client.generate_thumbnail(x, y, url)
thumbnail_bytes = bytearray()
for chunk in thumbnail:
thumbnail_bytes.extend(chunk)
@GeekTrainer Thanks for the feedback. The link to the source code of azure SDK code for cognitive services is usually at the top of the page.
Along with some examples from the Azure-Samples repo at the bottom of page for all services.
These links usually contain examples that we cannot cover in the documentation and I usually use these pages to lookup for additional examples. I hope these are helpful as you explore more about our services.
@GeekTrainer We will now proceed to close this thread. If there are further questions regarding this matter, please tag @RohitMungi-MSFT in your reply.
@RohitMungi-MSFT
While an example exists for generating a thumbnail with REST, one doesn't exist for the SDK. Because the reference documentation for the SDK is auto-generated it contains no samples, so determining how to access the image from the return value for generate_thumbnail is challenging at best.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.