Skip to main content

Quote2Image

A python module to convert text quotes into graphical images

Installation

To install Quote2Image, you can use pip:

pip install Quote2Image

Usage

The Convert function takes the following arguments:

  • quote : The quote to convert.

  • author : The author of the quote.

  • fg : The foreground color of the text.

  • bg : The background color of the image.

  • font_type : The font to use for the text.

  • font_size : This font size is used for the quote and watermark.

  • font_size_author : This font size is used for the author (Optional, Default value is set to font_size).

  • width : The width of the image.

  • height : The height of the image.

  • watermark_text : The text for the watermark (Leave it blank for no watermarks).

  • watermark_font_size : The font size for the watermark text (Optional, Default save is set to font_size).

Generating an image using RGB background and foreground

The package comes with a builtin GenerateColors function that generates a fg and bg color with the correct amount of luminosity and returns them in tuples.

from Quote2Image import Convert, GenerateColors



# Generate Fg and Bg Color

fg, bg = GenerateColors()



img=Convert(

	quote="Pooing keeps you healthy",

	author="Pee",

	fg=fg,

	bg=bg,

	font_size=32,

	font_type="arial.ttf",

	width=1080,

	height=450)



# Save The Image as a Png file

img.save("hello.png")

Generating an image using a custom background image.

We can do that using the ImgObject that gives us alot of flexibility on how we want our background Image to be.

The ImgObject class takes the following arguments:

  • image : The link to the background image (required).

  • brightness : The brightness of the image (optional, default is 100).

  • blur : The blur of the image (optional, default is 0).

You can then use the ImgObject instance as the bg argument in the convert function:

from Quote2Image import Convert, ImgObject



bg=ImgObject(image="IMAGE FILE LOCATION", brightness=80, blur=80)



img=Convert(

	quote="Pooing keeps you healthy",

	author="Pee",

	fg=(21, 21, 21),

	bg=bg,

	font_size=32,

	font_type="arial.ttf",

	width=1080,

	height=450)



# Save The Image as a Png file

img.save("hello.png")

Adding a watermark:

  • watermark_text : The text for the watermark.

  • watermark_font_size : The font size for the watermark text.

from Quote2Image import Convert, GenerateColors



# Generate Fg and Bg Color

fg, bg = GenerateColors()



img=Convert(

	quote="Pooing keeps you healthy",

	author="Pee",

	fg=fg,

	bg=bg,

	font_size=32,

	font_type="arial.ttf",

	font_size_author=25,

	width=1080,

	height=450,

    	watermark_text="@My.Watermark",

    	watermark_font_size=15

)



# Save The Image as a Png file

img.save("hello.png")

Permissions

  • You are allowed to use, modify, and distribute the module.

  • You are allowed to distribute modified versions of the module, as long as you follow the terms of the license.

Obligations

  • You must include a copy of the GPL-3.0 license with the module.

  • You must provide a copy of the source code of the module, either along with the modified version of the module or through a written offer to provide the source code.

  • You must provide a prominent notice stating that you have modified the module, and the date of the modification.

  • If you distribute the module, you must do so under the terms of the GPL-3.0 license.

That's It!

Thank You! Hope this was useful to you <3

Metadata

Release files for Quote2Image 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Quote2Image 0.0.5
File Size Uploaded
Quote2Image-0.0.5.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Quote2Image 0.0.5
File Interpreter ABI Platform
Quote2Image-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 32.8 kB

Release files / Quote2Image-0.0.5.tar.gz

Download URL Quote2Image-0.0.5.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e5171ec3d4204ad506ade76f533814126361602ff0141681ce23fbcfe29ac690
BLAKE2b-256 checksum
How to use checksums
13b173e4cd63745139ed15b1bfc1f3a38d72e482c8b7f395ce66cbcdec82191b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / Quote2Image-0.0.5-py3-none-any.whl

Download URL Quote2Image-0.0.5-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d13b434af49f9ed2f2322ffd8b806267645f056634984e0f667a7b4dc125a2b9
BLAKE2b-256 checksum
How to use checksums
2df2fb13680b2522f57d9f5984ed8b1ac8abc2b2939db287d1585a0219725731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page