pycharmers.cli.tweetile module

pycharmers.cli.tweetile.tweetile(argv=['-M', 'html', '.', '_build'])[source]

Divide one image into three so that you can tweet beautifully.

Parameters
  • path (str) – Path to the input image.

  • --quality (int) – The image quality, on a scale from 1 (worst) to 95 (best). Defaults to 95.

  • --loop (int) – How many times gif image loops. Defaults to 0. (infinite loop.)

Note

When you run from the command line, execute as follows:

$ tweetile path/to/filename.jpg --quality 75
$ tweetile path/to/filename.gif --loop 0

Example

_images/cli.tweetile-shingeki1.gif _images/cli.tweetile-shingeki2.gif
_images/cli.tweetile-shingeki3.gif

This movie is from @anime_shingeki

pycharmers.cli.tweetile.divideInto3forTweet()[source]

Divide Image into 3 for Tweet

Size

_images/cli.tweetile-size.jpg
Parameters

img_arr (NDArray[(636,1132,Any), np.uint8]) – Input image array (RGB)

Returns

A tuple of each Image object divided into three.

Return type

Tuple[Image.Image,Image.Image,Image.Image]

Examples

>>> import cv2
>>> from pycharmers.cli.tweetile import divideInto3forTweet
>>> img_bgr = cv2.imread("cli.tweetile-before.jpg")
>>> img_rgb = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)
>>> for i,img in enumerate(divideInto3forTweet(img_rgb), start=1):
...     img.save(f"cli.tweetile-after{i}.jpg", quality=95)

Example

Before

After

_images/cli.tweetile-before.jpg _images/cli.tweetile-after1.jpg _images/cli.tweetile-after2.jpg
_images/cli.tweetile-after3.jpg