Skip to main content

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 in different sizes with user-defined width and height.
  • Overlay PNG: Option to overlay a PNG image (resized to fit the flag) on the generated bitmap flags.

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

You can generate flags by specifying the flag names, output format, sizes, 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"
sizes = ["100", "200", "300"]  # For bitmap flags, or use "svg" for vector flags
output_dir = "./generated_flags"
overlay_path = "./overlay_image.png"  # Optional overlay image path

generate_flags(flags, output_format, sizes, output_dir, overlay_path)

Available Pride Flags

  • Transgender Pride: "trans"
  • Gay Pride: "gay"
  • Bisexual Pride: "bi"
  • Nonbinary Pride: "nonbinary"

You can easily extend the PRIDE_FLAGS dictionary with more flags.

Bitmap Flags

Bitmap flags are generated in PNG format. The sizes argument is a list of integers (e.g., ["100", "200", "300"]) that specify the sizes of the generated images. 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 match the flag's size).

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, pass "svg" in the sizes argument.

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. For example:

overlay_path = "./overlay_image.png"  # Optional PNG overlay image path

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes.
  4. Commit your changes (git commit -am 'Add new feature').
  5. Push to the branch (git push origin feature-branch).
  6. Create a new Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

fagflag-1.0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fagflag-1.0.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file fagflag-1.0.2.tar.gz.

File metadata

  • Download URL: fagflag-1.0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for fagflag-1.0.2.tar.gz
Algorithm Hash digest
SHA256 57b7c6517aefeaac4a2fa45ac69bd1b53ebc76fc10b0c932828909f673de88eb
MD5 9e4f7e27cf77bead19c6facdf388d38c
BLAKE2b-256 70e414a5e494ae19b87c67699096e4a6ff1dcb2f1587498fdd97e7e12743531d

See more details on using hashes here.

File details

Details for the file fagflag-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: fagflag-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for fagflag-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9cdb40e4119d850093dc030798a4aeb0a5cf0931ead2ae5f6f1a7b95eaee6173
MD5 3f5fd38285601d67235e0056427781fd
BLAKE2b-256 3aa9a5480b08fc432965c465c2d8828191bfc5510e7d44f7d5ca7df4d7269e03

See more details on using hashes here.

Supported by

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