Can you provide Python code to download an image from a URL and convert it to a thumbnail?
- User
Can you provide Python code to download an image from a URL and convert it to a thumbnail?
Assistant
Here's code that does that using the requests and PIL libraries: from requests import get from PIL import Image from io import BytesIO io = BytesIO() get('https://www.python.org/static/img/python-logo.png', stream=True).read() io.seek(0) thumb = Image.open("python-logo.png") thumb.resize((250, 200), Image.ANTIALIAS) thumb.save(io, format='PNG') io.seek(0) io.read()
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.