Generate pride flags as bitmap or vector images
Project description
FagFlag
A Python package to generate pride flags in bitmap (PNG) or vector (SVG) formats. Supports a variety of pride flag color schemes and allows generating flags in customizable sizes with the option to overlay PNG images.
Features
- Generate Bitmap Flags (PNG): Create pride flags in bitmap format with customizable sizes and optional PNG overlay.
- Generate Vector Flags (SVG): Generate pride flags in SVG format with a fixed aspect ratio.
- Color Schemes: Includes several popular pride flag color schemes (e.g., Transgender, Gay, Bi, Nonbinary).
- Output Flexibility: Supports generating flags in either "bitmap" (PNG) or "vector" (SVG) formats.
- Customizable Sizes: Bitmap flags can be generated with user-defined width and height. By default, flags are generated with a 1:1 aspect ratio (e.g., 512x512).
- Overlay PNG: Option to overlay a PNG image on the generated bitmap flags. The image will be resized to fit the flag and centered without stretching.
- Command-Line Interface: You can generate flags directly from the command line with various options for sizes, formats, overlays, and more.
Installation
To install the package, use pip:
pip install fagflag
Alternatively, you can clone the repository and install it locally:
git clone https://github.com/Red-Panda-Studios/fagflag
cd fagflag
pip install .
Usage
Importing the Package
from fagflag import generate_flags
Generating Flags Programmatically
You can generate flags by specifying the flag names, output format, width, height, output directory, and optionally, a PNG overlay image.
from fagflag import generate_flags
# Example usage: Generate pride flags
flags = ["trans", "gay", "bi"]
output_format = "bitmap" # Can be "bitmap" or "vector"
width = 256 # Flag width
height = 256 # Flag height
output_dir = "./generated_flags"
overlay_path = "./overlay_image.png" # Optional overlay image path
generate_flags(flags, output_format, width, height, output_dir, overlay_path)
Command-Line Usage
You can also generate flags from the command line using the following arguments:
python -m fagflag --create --flags trans,gay,bi --format bitmap --width 256 --height 256 --output ./generated_flags --overlay ./overlay_image.png
Available Arguments
--create: Generate flags.--flags: Comma-separated list of flags to generate (e.g.,trans,gay,bi).--format: Output format, eitherbitmap(PNG) orvector(SVG).--width: Width of the generated flags (overrides sizes for bitmap).--height: Height of the generated flags (overrides sizes for bitmap).--output: Directory to save the generated flags.--overlay: Optional path to a PNG image to overlay on the generated bitmap flags.
Available Pride Flags
Here is a table of the available pride flags that you can generate:
| Flag Name | Description |
|---|---|
trans |
Transgender Pride |
gay |
Gay Pride |
bi |
Bisexual Pride |
nonbinary |
Nonbinary Pride |
pan |
Pansexual Pride |
asexual |
Asexual Pride |
genderfluid |
Genderfluid Pride |
lesbian |
Lesbian Pride |
aromantic |
Aromantic Pride |
demiboy |
Demiboy Pride |
demigirl |
Demigirl Pride |
transfemme |
Transfemme Pride |
transmasc |
Transmasc Pride |
mlm |
MLM Pride |
Flag Color Schemes
Each flag's colors are defined by a list of hex codes. Here are the colors for the listed flags:
| Flag Name | Colors |
|---|---|
trans |
["#5bcffa", "#f5a9b8", "#FFFFFF", "#f5a9b8", "#5bcffa"] |
gay |
["#e50203", "#ff8b01", "#feed00", "#008026", "#004dfe", "#750685"] |
bi |
["#d70071", "#d70071", "#9c4e97", "#0035aa", "#0035aa"] |
nonbinary |
["#fff430", "#FFFFFF", "#9c59d1", "#292929"] |
pan |
["#ff1b8d", "#ffd900", "#1bb3ff"] |
asexual |
["#000000", "#a4a4a5", "#ffffff", "#810081"] |
genderfluid |
["#ff75a2", "#ffffff", "#be18d6", "#000000", "#333ebd"] |
lesbian |
["#d62900", "#ff9b55", "#ffffff", "#d462a6", "#a40062"] |
aromantic |
["#3da542", "#a7d379", "#ffffff", "#a9a9a9", "#000000"] |
demiboy |
["#7f7f7f", "#c3c3c3", "#99d9ea", "#FFFFFF", "#99d9ea", "#c3c3c3", "#7f7f7f"] |
demigirl |
["#7f7f7f", "#c3c3c3", "#ffaec9", "#FFFFFF", "#ffaec9", "#c3c3c3", "#7f7f7f"] |
transfemme |
["#74deff", "#ffe1ed", "#ffb5d6", "#fe8cbf", "#ffb5d6", "#ffe1ed", "#74deff"] |
transmasc |
["#ff8bbf", "#cdf5ff", "#9aedff", "#76e0ff", "#9aedff", "#cdf5ff", "#ff8bbf"] |
mlm |
["#018e71", "#21cfac", "#99e9c2", "#ffffff", "#7cafe3", "#4f47cd", "#3a1379"] |
Bitmap Flags
Bitmap flags are generated in PNG format. You can specify the width and height of the generated flags, and the images will be saved in the output directory with filenames like flag_name_widthxheight.png. You can also pass an optional PNG image to overlay on the flag (the image will be resized to fit the flag's size and centered).
Vector Flags
Vector flags are generated in SVG format with a fixed height of 100 units and a 2:1 aspect ratio. To generate vector flags, use the format="vector" and specify the output width and height.
Overlaying PNG
You can optionally provide a PNG image to overlay on the bitmap flags. The image will be resized to fit the width and height of the generated flag and will be centered without stretching. For example:
overlay_path = "./overlay_image.png" # Optional PNG overlay image path
Contributing
Contributions are welcome! Feel free to submit issues or pull requests.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-branch). - Create a new Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fagflag-1.0.10.tar.gz.
File metadata
- Download URL: fagflag-1.0.10.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f22b0b006a9acd1d3e230f4e39e914604c57f920882582bdcf6dd4c271c0eab0
|
|
| MD5 |
e18f09b33a485d828be0f62fcaab7353
|
|
| BLAKE2b-256 |
b7281a3b06d3a8421749df1dc7c68658463e5588b400e08bf1eee9365987c7e5
|
File details
Details for the file fagflag-1.0.10-py3-none-any.whl.
File metadata
- Download URL: fagflag-1.0.10-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59b2330511de5ed1fa5c2187c80043f1ce9946e0dcf5926f50883b1122060770
|
|
| MD5 |
2f9334bd40d9d5d82d390c511f15de18
|
|
| BLAKE2b-256 |
5208c56a357b2f91f365ac878b8c6a9ed1257aa16e9995d0b14ca2f9d3a646f2
|