Skip to main content

Python application that can be used to generate video thumbnail for mp4 and mkv file types.

Project description

Thumbnail Generator 🎬

github actions Codacy Badge made-with-python PyPI version

What is This


This is a Python application that can be used to generate video thumbnail for mp4 and mkv file types.

Imgur

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 to False and add a custom font file location.
  • If you do not set the columns size, it will use the default value (3)
Generator(video_path, output_path='', rows=0, columns=0, imgCount=0, custom_text='True', font_dir='', font_size=0, bg_colour='', font_colour='')

Example 1

from thumb_gen import Generator

app = Generator(video_path="C:/input/video.mp4",
                output_path="C:/output/",
                custom_text="www.example.com",
                font_dir="C:/Windows/Fonts/Arial.ttf",
                font_size=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(video_path=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()

Example 3

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(video_path=os.path.join(folder, video),
                        columns=5,
                        rows=10,
                        custom_text=False,
                        font_dir="C:/Project/font.ttf",
                        font_size=25,
                        bg_colour='blue',
                        font_colour='red')
        app.run()

Project details


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-4.0.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

thumb_gen-4.0.1-py3-none-any.whl (85.6 kB view details)

Uploaded Python 3

File details

Details for the file thumb_gen-4.0.1.tar.gz.

File metadata

  • Download URL: thumb_gen-4.0.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for thumb_gen-4.0.1.tar.gz
Algorithm Hash digest
SHA256 3d6f5792007cbdb5ff7aec2d30252c8e98ab4312b534b2abf88e4f96e6b6d105
MD5 43c9d3f1cefa618355baae5de929970a
BLAKE2b-256 af88eb33694aac7990843039d42bdb065485953604bb5d2fc4a11fe56ed9bd3a

See more details on using hashes here.

File details

Details for the file thumb_gen-4.0.1-py3-none-any.whl.

File metadata

  • Download URL: thumb_gen-4.0.1-py3-none-any.whl
  • Upload date:
  • Size: 85.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for thumb_gen-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e1496a97cdfacdd45706c613c2876f82d70b3db631ffa5f10d94aefac3af1ec
MD5 b7947bd717ef6b7a560b19f268474c43
BLAKE2b-256 c664c18543c1834500a3165db81503c928ddaa3dc960b5e3acc23d803c4df3e7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page