instagram_private_api_extensions icon indicating copy to clipboard operation
instagram_private_api_extensions copied to clipboard

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

Open b3nab opened this issue 5 years ago • 0 comments

Before submitting this issue I have:

  • [x] Updated to the lastest version v0.3.8
  • [x] Read the README
  • [x] Searched the bugtracker for similar issues including closed ones

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 ! :)

b3nab avatar Apr 06 '19 19:04 b3nab