python – How do you crop an image to be circular with pillow in discord.py?
Its complaining because a Discord
Asset object does not have the attribute
size according to the docs.
What you want to use instead is the PIL Image object which has the
size attribute you are looking for. This can be done by slightly changing your code:
asset = user.avatar_url_as(size=128) data = BytesIO(await asset.read()) pfp = Image.open(data) # Instead of using asset.size, we use pfp.size. pfp is a PIL Image object # that has the size attribute. bigsize = (pfp.size * 3, pfp.size * 3)