ScreenshotFormat
Python package to help create screenshot to upload on stores
Instantiate the helper with your screenshot, and the desired store image size
from ScreenshotFormat import ScreenshotFormat, StoreSizeName, BackgroundType, Position
# 1. your screenshot
# - pass the path of your screenshot with "screenshot_path"
# - Or directly a PIL image with "screenshot_img"
2. screenshot size
# - By using the Enum StoreSizeName in "store_size_name" param
# - Or by passing a tuple (with, height) in "store_size"
helper = ScreenshotFormat(
screenshot_path=PATH_SCREENSHOT,
store_size_name=StoreSizeName.iphone_6_5)
Retrieve sizes
# get your screenshot size with :
width, height = helper.screenshot_size
# get your store size with :
width, height = helper.store_size
Crop your screenshot
helper.crop_screenshot(left=None, top=100, right=None, bottom=None)
Resize your screenshot
A ratio will multply width & height to keep
helper.resize_screenshot(zoom_ratio=1.3)
Pass the desired size
helper.resize_screenshot(size=(1080, 1920))
Create a background
the image created will have the size of the store you pass the constructor. All the background types are inside the Enum "BackgroundType":
- plain : A background with only one color
- vertical_gradient : A gradient from top to bottom
- horizontal_gradient : A gradient from left to right
- diagonal_gradient_right : A gradient from the top right corner to the bottom left corner
- diagonal_gradient_left : A gradient from the top left corner to the bottom right corner
You can pass as many color as you want in the "color_palette" argument
background = helper.create_background(type_=BackgroundType.diagonal_gradient_right, color_palette=[
(255, 0, 0),
(255, 255, 0),
(255, 255, 255),
])
Adding text
text_position = (Position.center, 150)
text = "My Caption"
background = helper.add_text_with_halo(background,
text=text,
position=text_position,
color=(0, 0, 0),
halo_col=(255, 255, 255),
font_path=PATH_TO_YOUR_FONT,
font_size=120)
Pasting the screenshot on the background
position = (Position.center, helper.store_height - helper.screenshot_height - 100)
final_image = helper.apply_screenshot_on_background(background, position)
Save image
ScreenshotFormat.save(img=final_image, path=OUTPUT_PATH, file_name="MyScreenshot.jpg")
Release files for ScreenshotFormat 1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ScreenshotFormat-1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / ScreenshotFormat-1-py3-none-any.whl
| Download URL | ScreenshotFormat-1-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b12d6552550ff6e0c973caf942025f4e69094a0cd60ac570f5f926456a0e952e
|
|
BLAKE2b-256 checksum How to use checksums |
73c77deeb5e002c0e8fcbfa629b203981b3b3aeff924299d5bf95630793aef81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.4
|