Python application that can be used to generate video thumbnail for mp4 and mkv file types.
Project description
Thumbnail Generator 🎬
What is This
This is a Python application that can be used to generate video thumbnail for mp4 and mkv file types.
Installation
You can use pip:
~$ pip3 install thumb-gen
Configurations
- The number of screen images that should be included in the final thumbnail image
- Thumbnail image quality
- Font type in the video info panel. You can add a file path of a font file (.ttf) to this
- Font size in the video info panel
- Custom text in the video info panel
- Background color of the thumbnail (Hex codes are also supported)
- Font colour of the thumbnail (Hex codes are also supported)
Download font files : FontSquirrel
~$ thumb-gen -c
or
~$ thumb-gen --config
By program default:
IMAGES = 12
IMAGE_QUALITY = 80
FONT =
FONT_SIZE = 20
CUSTOM_TEXT =
BG_COLOUR = white
FONT_COLOUR = black
Usage
Usage options
Usage: thumb-gen file file
usage: thumb-gen dir dir
Options:
-h, --help show this help message and exit
-c, --config configurations (images, image quality, font, font size,
custom text, bg color, font color)
-v, --version show thumb-gen version and exit
Console
~$ thumb-gen -h
~$ thumb-gen --help
~$ thumb-gen -c
~$ thumb-gen --config
~$ thumb-gen -v
~$ thumb-gen --version
~$ thumb-gen input.mp4
~$ thumb-gen input.mp4 input2.mp4
~$ thumb-gen "d:/videos/input.mp4"
~$ thumb-gen "/videos"
~$ thumb-gen "/videos" "/videos2"
~$ thumb-gen "d:/videos"
Python
- If you don't set an output folder, thumbnail images will be saved in the video folder (video_path).
- If you don't need a custom text and custom font file (including font size) and you have already set these for the configuration file (using console or defaults), it will be added automatically. To avoid this set the
custom_text
value toFalse
and add a custom font file location.
Example 1
from thumb_gen import Generator
#video_path, output_path='', custom_text=True, font_dir='', font_size=0, bg_colour='', font_colour=''
app = Generator("C:/input/video.mp4", "C:/output/", "www.example.com", "C:/Windows/Fonts/Arial.ttf", 30)
app.run()
Example 2
import os
from thumb_gen import Generator
folder = 'C:/input'
for video in os.listdir(folder):
if video.endswith('.mp4') or video.endswith('.mkv'):
app = Generator(os.path.join(folder, video), custom_text=False, font_dir="C:/Project/font.ttf", font_size=25, bg_colour='blue', font_colour='red')
app.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
thumb_gen-3.0.2.tar.gz
(11.5 kB
view hashes)
Built Distribution
thumb_gen-3.0.2-py3-none-any.whl
(85.1 kB
view hashes)
Close
Hashes for thumb_gen-3.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5e78ba131f0bcfb2dd6a8f3880d9fc14187db6cfe275d659a239e955455086a |
|
MD5 | 1f8aa911dbf34d525706317af1d96beb |
|
BLAKE2b-256 | 1d05e57b5174771422cf53a65b9bb37e5cdf5c5494c4c01c40b13e6b2172dae4 |