A Python application that allows users to create custom dog bandana designs by overlaying text on images or using different fonts to create text-based designs.
- Create text overlays on background images
- Generate text-based designs using various fonts
- Preview thumbnails in an image gallery
- Support for multiple image formats (PNG, JPG, JPEG, TIFF, BMP, GIF)
- Support for various font formats (TTF, OTF, TTC)
- Interactive GUI for design selection
- Python 3.x
- PIL (Python Imaging Library/Pillow)
- tkinter (usually comes with Python)
- Ensure Python 3.x is installed on your system
- Install required dependencies: pip install Pillow
The program consists of several main classes:
Graphic: Handles individual images and text renderingOverlay: Manages the combination of background images and textImageLibrary: Manages collections of images and fontsImageGallery: Provides the GUI interface for image selection
Create an instance of ImageLibrary by providing a directory containing images or fonts:
For images
image_library = ImageLibrary("path/to/image/directory")For text with fonts
text_library = ImageLibrary("path/to/font/directory", "Your Text")background = Graphic("background.png")
text = Graphic("font.ttf", "Your Text")
overlay = Overlay(background, text)final_image = overlay.getImage()root = tk.Tk()
library = ImageLibrary("path/to/images")
gallery = ImageGallery(root, library)
gallery.pack()
root.mainloop()Default image size can be modified by changing the DEFAULTSIZE constant
Thumbnail sizes can be adjusted using setThumbnailSize()
Text scaling can be modified through the SCALEFACTOR parameter
- Images
- PNG (.png)
- JPEG (.jpg, .jpeg)
- TIFF (.tiff)
- BMP (.bmp)
- GIF (.gif)
- Fonts
- TrueType (.ttf)
- OpenType (.otf)
- TrueType Collection (.ttc)
-
The program automatically handles image resizing and text fitting
-
Text is automatically centered on the image
-
Images can be mirrored for printing using getPrintImage()
-
The gallery interface automatically adjusts based on window size