ping / instagram_private_api_extensions

An extension module to https://github.com/ping/instagram_private_api
MIT License
124 stars 26 forks source link

prepare_image() and prepare_video() wrong defaults max_size for story upload #10

Open b3nab opened 5 years ago

b3nab commented 5 years ago

Before submitting this issue I have:


Describe the Bug/Error:

It was referenced on b3nab/instapy-cli#37

I think that there is the need for a minimal change in media.py file or specify a new variable for the max_size parameter in media.prepare_image() and media.prepare_video() to mimic MediaRatios.reel and MediaRatios.standard. At the moment an image with a good ratio, 1080:1920 is 0.5625, but it's resized because of the default max_size params has been set to (1080, 1350), instead it should be at least (1080, 1920) to support instagram stories.

Paste the output of python -V here: Python 3.7.1 Code:

# Example code that will produce the error reported
from instagram_web_api_extensions import media

img_path = 'image-story.jpg'e
ratio = MediaRatios.reel
print('ratio is: ', ratio)
image_data, image_size = media.prepare_image(img_path, aspect_ratios=ratio)
print('image size: {} with ratio of: {}'.format(image_size, image_size[0]/image_size[1]))

Error/Debug Log:

ratio is: (0.5625, 0.75)
image size: (759, 1350) with ratio of: 0.5622222222222222

So what are your suggestions, create a new variable like MediaRatios to configure properly the size when prepare a media? Or just change that max_size=(1080, 1350) to a better max_size=(1080, 1920)?

However, thanks for your work ! :)