PixelGen
PixelGen is a Python library that simplifies pixel art creation, making it faster and more detailed. This library provides various tools to create, manipulate, and generate pixel art.
🚀 Features
- Create pixel art canvas with customizable dimensions
- Individual pixel manipulation
- Area filling with colors
- Color gradient generation
- Pattern creation
- Save results in image format
📦 Installation
pip install pixelgen
🎨 Basic Usage
Creating Simple Pixel Art
from pixelgen.core import PixelGenerator
from pixelgen.tools import create_gradient, create_pattern
# Initialize a 32x32 canvas
pixel_art = PixelGenerator(32, 32)
# Set individual pixels
pixel_art.set_pixel(0, 0, (255, 0, 0)) # Red
pixel_art.set_pixel(1, 1, (0, 255, 0)) # Green
# Fill area with color
pixel_art.fill_area(10, 10, 20, 20, (0, 0, 255)) # Blue area
# Save result
pixel_art.save_image("pixel_art_result.png")
Creating Gradients
# Create gradient from red to blue with 10 steps
gradient = create_gradient((255, 0, 0), (0, 0, 255), 10)
Creating Patterns
# Create 8x8 checkered pattern
pattern = create_pattern(8, (255, 0, 0), (0, 0, 255))
📚 API Reference
PixelGenerator
__init__(width: int, height: int)
Creates a new pixel art canvas with specified dimensions.
set_pixel(x: int, y: int, color: tuple)
Sets color for a specific pixel.
x, y: Pixel coordinatescolor: RGB tuple (red, green, blue)
fill_area(x1: int, y1: int, x2: int, y2: int, color: tuple)
Fills a rectangular area with a specific color.
x1, y1: Top-left corner coordinatesx2, y2: Bottom-right corner coordinatescolor: RGB tuple (red, green, blue)
save_image(filename: str)
Saves pixel art as an image file.
filename: Output filename
Tools
create_gradient(color1: tuple, color2: tuple, steps: int)
Creates a gradient between two colors.
color1: Starting color (RGB)color2: Ending color (RGB)steps: Number of gradient steps
create_pattern(pattern_size: int, color1: tuple, color2: tuple)
Creates a checkered pattern.
pattern_size: Pattern sizecolor1, color2: Colors for pattern (RGB)
🌟 Advanced Examples
Creating Complex Patterns
# Create a rainbow gradient
colors = [
(255, 0, 0), # Red
(255, 127, 0), # Orange
(255, 255, 0), # Yellow
(0, 255, 0), # Green
(0, 0, 255), # Blue
(75, 0, 130), # Indigo
(148, 0, 211) # Violet
]
# Apply gradient to canvas
for i, color in enumerate(colors):
pixel_art.fill_area(i*4, 0, (i+1)*4, 32, color)
🔧 Requirements
- Python >= 3.6
- PIL >= 5.2.0
- NumPy
🤝 Contributing
Contributions are always welcome! Please feel free to submit a Pull Request or create an Issue for any improvements or suggestions.
Development Setup
- Clone the repository
git clone https://github.com/rifqanzalbina/product-generator.git
- Install development dependencies
pip install -r requirements.txt
- Run tests
python -m pytest
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
👤 Author
- Rifqan Zalbina (zalbinarifqan19@gmail.com)
🔗 Links
🗺️ Roadmap
- Add more pattern generation tools
- Implement layer system
- Add undo/redo functionality
- Add AI-powered pixel art generation
- Implement real-time preview
- Add export to multiple formats
❓ FAQ
Q: Can I use this for commercial projects? A: Yes, PixelGen is released under the MIT license, which allows commercial use.
Q: What image formats are supported? A: Currently, PixelGen supports saving to common image formats like PNG, JPEG, and BMP.
Q: Is there a size limit for pixel art? A: The size is limited only by your system's memory capacity.
Metadata
Release files for pixelgen 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pixelgen-0.0.8.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pixelgen-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.2 kB
Release files / pixelgen-0.0.8.tar.gz
| Download URL | pixelgen-0.0.8.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05ce2643d4b5df5e973e9bcfd6d3f53e4a44776816d6d274b28b54303e4fc528
|
|
BLAKE2b-256 checksum How to use checksums |
1c78a9d4e8d10babb7612fd73eb67f99464adda1489c8708dc4f1071b72812a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|
Release files / pixelgen-0.0.8-py3-none-any.whl
| Download URL | pixelgen-0.0.8-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f108887e34f84b9ded86d5cea503e70b9f6e9462f129c47919cc6ff79375bae
|
|
BLAKE2b-256 checksum How to use checksums |
633092e0bbc71d3b67ea473d8223f16058b860e47b7d72424353d5f717646e25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|