Monday, 21 December 2020

Upload vertical images to instagram using Python

I'm taking the risk to be marked as duplicated with this question. I wanted to know if there's a way to upload vertical images using the instabot library. So far I used the following code to upload images to an IG account:

from instabot import Bot 

username = "dosisdelpasado"
password = "**************"
image_path = "path/path"
caption = "aun sigo testeando"

bot = Bot() 
bot.login(username=username, password=password) 

result = bot.upload_photo(image_path,caption= caption)

The main issue is that instabot doesn't distinguish between vertical-oriented and horizontal-oriented images, and assume that all of them are vertical images. Digging a little bit in the source code, I came to this function defined inside api_phot.py, which seems to identify the pixel size of the image, as get_image_size(fname) and compatible_aspect_ratio(size), but after a while of playing with the code, I didn't solve this annoying problem.

Will be really useful if you can help me with this issue. Thanks in advance for your time!!



from Upload vertical images to instagram using Python

No comments:

Post a Comment