Dolze Templates
A powerful Python library for generating stunning, dynamic images using JSON templates
Overview
Dolze Templates is a versatile Python library designed to simplify the creation of dynamic, visually appealing images through intuitive JSON templates. Perfect for generating social media posts, marketing materials, product showcases, and more, Dolze Templates empowers developers to craft professional-grade visuals with minimal effort.
✨ Features
Dynamic Image Generation: Create stunning images programmatically using JSON templates.
Rich Component Library: Includes text, images, buttons, shapes, and more for flexible designs.
High Performance: Optimized with intelligent caching for fast image generation.
Extensible Architecture: Easily add custom components and templates to suit your needs.
Advanced Styling: Supports transparency, gradients, shadows, and other visual effects.
Responsive Design: Templates adapt seamlessly to various dimensions and resolutions.
Robust Validation: Comprehensive input validation with clear, helpful error messages.
CLI Support: Process templates efficiently using the built-in command-line interface.
📦 Installation
Dolze Templates requires Python 3.8 or higher. Install the latest version from PyPI:
pip install dolze-templates
Optional Dependencies
Enhance functionality with additional dependencies:
# For image processing
pip install dolze-templates[images]
# For advanced text rendering
pip install dolze-templates[text]
# For all optional dependencies
pip install dolze-templates[all]
Development Setup
To contribute or modify the source code:
git clone https://github.com/yourusername/dolze-templates.git
cd dolze-templates
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e ".[dev]"
pytest # Run tests
🚀 Quick Start
Basic Usage
Render a template with a few lines of code:
from dolze_image_templates import TemplateEngine
# Initialize the template engine
engine = TemplateEngine(output_dir="./output", cache_dir="./cache")
# Process a template
result = engine.process_from_file("templates/social_media_post.json")
print(f"Generated: {result}")
Rendering with Variables
Dynamically populate templates with custom data:
from dolze_image_templates import TemplateEngine
engine = TemplateEngine()
context = {
"heading": "Welcome to Dolze",
"subheading": "Create amazing images with ease",
"image_url": "https://example.com/hero.jpg"
}
result = engine.process_template("brand_info", template_config, context)
print(f"Image saved to: {result}")
Command-Line Interface
Use the CLI for quick template processing:
# Render a single template
dolze-templates render templates/post.json -o output/
# Process all templates in a directory
dolze-templates render templates/ -o output/ --recursive
# Clear cache
dolze-templates cache clear
🎨 Available Templates
Template Name
Description
Sample
brand_info
Professional brand information card
View Sample
quote_template
Elegant quote display with styling
View Sample
product_showcase
Product showcase with details and images
View Sample
Explore more templates in the examples/ directory.
🧩 Components
Dolze Templates provides a rich set of built-in components:
Text Component
{
"type": "text",
"text": "Hello, World!",
"position": [100, 200],
"font_size": 36,
"color": [0, 0, 0, 255],
"font_path": "Poppins-Bold",
"max_width": 800
}
Image Component
{
"type": "image",
"image_url": "https://example.com/image.jpg",
"position": [0, 0],
"size": [800, 600],
"border_radius": 10,
"opacity": 0.9
}
Button Component
{
"type": "cta_button",
"text": "Click Me",
"position": [100, 400],
"size": [200, 50],
"bg_color": [33, 150, 243, 255],
"text_color": [255, 255, 255, 255],
"corner_radius": 25
}
🛠️ Advanced Usage
Custom Components
Extend functionality by creating custom components:
from dolze_image_templates.components import Component
from PIL import Image, ImageDraw
class CustomShapeComponent(Component):
def **init**(self, position, size, color, **kwargs):
super().**init**(position=position, **kwargs)
self.size = size
self.color = color
def render(self, image, context):
draw = ImageDraw.Draw(image)
draw.rectangle(
[self.x, self.y, self.x + self.size[0], self.y + self.size[1]],
fill=tuple(self.color)
)
return image
# Register the component
from dolze_image_templates import get_template_registry
registry = get_template_registry()
registry.register_component('custom_shape', CustomShapeComponent)
Template Structure
Define templates using JSON:
{
"name": "social_media_post",
"settings": {
"size": [1080, 1080],
"background_color": [255, 255, 255, 255]
},
"components": [
{
"type": "text",
"text": "${greeting}",
"position": [100, 100],
"font_size": 64,
"color": [0, 0, 0, 255]
}
]
}
📋 Template Variables
Templates support dynamic variables for flexible content:
logo_url: URL to your logo
image_url: URL to the main image
heading: Primary text
subheading: Secondary text
cta_text: Call-to-action text
contact_email: Contact email
contact_phone: Contact phone
website_url: Website URL
quote: Quote text for quote templates
📚 API Reference
TemplateEngine
The core class for processing templates:
engine = TemplateEngine(
output_dir='output',
cache_dir='.cache',
auto_create_dirs=True
)
result = engine.process_from_file('template.json')
TemplateRegistry
Manages components and template loaders:
registry = get_template_registry()
registry.register_component('custom', CustomComponent)
🤝 Contributing
We welcome contributions! To get started:
Fork the repository
Create a feature branch: git checkout -b feature/your-feature
Commit changes: git commit -m 'Add your feature'
Push to the branch: git push origin feature/your-feature
Open a pull request
See Contributing Guidelines for details.
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
📬 Contact
For support or inquiries, open an issue on GitHub or email us at support@dolze.com.
Made with ❤️ by the Dolze Team
Raw data
{
"_id": null,
"home_page": "https://github.com/yourusername/dolze-templates",
"name": "dolze-image-templates",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Dolze Team",
"author_email": "Dolze team <dolze@team.com>",
"download_url": "https://files.pythonhosted.org/packages/21/ec/ccc06f7ce8c5bb25c69a3c0afc644ef9aa227dbdaabd1c77f596dda3a4a5/dolze_image_templates-0.6.1.tar.gz",
"platform": null,
"description": "Dolze Templates\nA powerful Python library for generating stunning, dynamic images using JSON templates\n\nOverview\nDolze Templates is a versatile Python library designed to simplify the creation of dynamic, visually appealing images through intuitive JSON templates. Perfect for generating social media posts, marketing materials, product showcases, and more, Dolze Templates empowers developers to craft professional-grade visuals with minimal effort.\n\u2728 Features\n\nDynamic Image Generation: Create stunning images programmatically using JSON templates.\nRich Component Library: Includes text, images, buttons, shapes, and more for flexible designs.\nHigh Performance: Optimized with intelligent caching for fast image generation.\nExtensible Architecture: Easily add custom components and templates to suit your needs.\nAdvanced Styling: Supports transparency, gradients, shadows, and other visual effects.\nResponsive Design: Templates adapt seamlessly to various dimensions and resolutions.\nRobust Validation: Comprehensive input validation with clear, helpful error messages.\nCLI Support: Process templates efficiently using the built-in command-line interface.\n\n\ud83d\udce6 Installation\nDolze Templates requires Python 3.8 or higher. Install the latest version from PyPI:\npip install dolze-templates\n\nOptional Dependencies\nEnhance functionality with additional dependencies:\n\n# For image processing\n\npip install dolze-templates[images]\n\n# For advanced text rendering\n\npip install dolze-templates[text]\n\n# For all optional dependencies\n\npip install dolze-templates[all]\n\nDevelopment Setup\nTo contribute or modify the source code:\ngit clone https://github.com/yourusername/dolze-templates.git\ncd dolze-templates\npython -m venv venv\nsource venv/bin/activate # On Windows: venv\\Scripts\\activate\npip install -e \".[dev]\"\npytest # Run tests\n\n\ud83d\ude80 Quick Start\nBasic Usage\nRender a template with a few lines of code:\nfrom dolze_image_templates import TemplateEngine\n\n# Initialize the template engine\n\nengine = TemplateEngine(output_dir=\"./output\", cache_dir=\"./cache\")\n\n# Process a template\n\nresult = engine.process_from_file(\"templates/social_media_post.json\")\nprint(f\"Generated: {result}\")\n\nRendering with Variables\nDynamically populate templates with custom data:\nfrom dolze_image_templates import TemplateEngine\n\nengine = TemplateEngine()\ncontext = {\n\"heading\": \"Welcome to Dolze\",\n\"subheading\": \"Create amazing images with ease\",\n\"image_url\": \"https://example.com/hero.jpg\"\n}\nresult = engine.process_template(\"brand_info\", template_config, context)\nprint(f\"Image saved to: {result}\")\n\nCommand-Line Interface\nUse the CLI for quick template processing:\n\n# Render a single template\n\ndolze-templates render templates/post.json -o output/\n\n# Process all templates in a directory\n\ndolze-templates render templates/ -o output/ --recursive\n\n# Clear cache\n\ndolze-templates cache clear\n\n\ud83c\udfa8 Available Templates\n\nTemplate Name\nDescription\nSample\n\nbrand_info\nProfessional brand information card\nView Sample\n\nquote_template\nElegant quote display with styling\nView Sample\n\nproduct_showcase\nProduct showcase with details and images\nView Sample\n\nExplore more templates in the examples/ directory.\n\ud83e\udde9 Components\nDolze Templates provides a rich set of built-in components:\nText Component\n{\n\"type\": \"text\",\n\"text\": \"Hello, World!\",\n\"position\": [100, 200],\n\"font_size\": 36,\n\"color\": [0, 0, 0, 255],\n\"font_path\": \"Poppins-Bold\",\n\"max_width\": 800\n}\n\nImage Component\n{\n\"type\": \"image\",\n\"image_url\": \"https://example.com/image.jpg\",\n\"position\": [0, 0],\n\"size\": [800, 600],\n\"border_radius\": 10,\n\"opacity\": 0.9\n}\n\nButton Component\n{\n\"type\": \"cta_button\",\n\"text\": \"Click Me\",\n\"position\": [100, 400],\n\"size\": [200, 50],\n\"bg_color\": [33, 150, 243, 255],\n\"text_color\": [255, 255, 255, 255],\n\"corner_radius\": 25\n}\n\n\ud83d\udee0\ufe0f Advanced Usage\nCustom Components\nExtend functionality by creating custom components:\nfrom dolze_image_templates.components import Component\nfrom PIL import Image, ImageDraw\n\nclass CustomShapeComponent(Component):\ndef **init**(self, position, size, color, **kwargs):\nsuper().**init**(position=position, **kwargs)\nself.size = size\nself.color = color\n\n def render(self, image, context):\n draw = ImageDraw.Draw(image)\n draw.rectangle(\n [self.x, self.y, self.x + self.size[0], self.y + self.size[1]],\n fill=tuple(self.color)\n )\n return image\n\n# Register the component\n\nfrom dolze_image_templates import get_template_registry\nregistry = get_template_registry()\nregistry.register_component('custom_shape', CustomShapeComponent)\n\nTemplate Structure\nDefine templates using JSON:\n{\n\"name\": \"social_media_post\",\n\"settings\": {\n\"size\": [1080, 1080],\n\"background_color\": [255, 255, 255, 255]\n},\n\"components\": [\n{\n\"type\": \"text\",\n\"text\": \"${greeting}\",\n\"position\": [100, 100],\n\"font_size\": 64,\n\"color\": [0, 0, 0, 255]\n}\n]\n}\n\n\ud83d\udccb Template Variables\nTemplates support dynamic variables for flexible content:\n\nlogo_url: URL to your logo\nimage_url: URL to the main image\nheading: Primary text\nsubheading: Secondary text\ncta_text: Call-to-action text\ncontact_email: Contact email\ncontact_phone: Contact phone\nwebsite_url: Website URL\nquote: Quote text for quote templates\n\n\ud83d\udcda API Reference\nTemplateEngine\nThe core class for processing templates:\nengine = TemplateEngine(\noutput_dir='output',\ncache_dir='.cache',\nauto_create_dirs=True\n)\nresult = engine.process_from_file('template.json')\n\nTemplateRegistry\nManages components and template loaders:\nregistry = get_template_registry()\nregistry.register_component('custom', CustomComponent)\n\n\ud83e\udd1d Contributing\nWe welcome contributions! To get started:\n\nFork the repository\nCreate a feature branch: git checkout -b feature/your-feature\nCommit changes: git commit -m 'Add your feature'\nPush to the branch: git push origin feature/your-feature\nOpen a pull request\n\nSee Contributing Guidelines for details.\n\ud83d\udcc4 License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\ud83d\udcec Contact\nFor support or inquiries, open an issue on GitHub or email us at support@dolze.com.\n\nMade with \u2764\ufe0f by the Dolze Team\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A package for generating Dolze templates",
"version": "0.6.1",
"project_urls": {
"Homepage": "https://github.com/yourusername/dolze-templates"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5ff8d89a93839811e93e208a1cde01e13688ecc883307a52cec4da72cb6022ad",
"md5": "6ae6b8ab3d4bb59e57062351ccf70ab3",
"sha256": "4f89114b33b7ff299e128c3b6a7dec0eb9dee83252d02b15e4051cea7c0897cf"
},
"downloads": -1,
"filename": "dolze_image_templates-0.6.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6ae6b8ab3d4bb59e57062351ccf70ab3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8878370,
"upload_time": "2025-07-14T07:15:48",
"upload_time_iso_8601": "2025-07-14T07:15:48.945891Z",
"url": "https://files.pythonhosted.org/packages/5f/f8/d89a93839811e93e208a1cde01e13688ecc883307a52cec4da72cb6022ad/dolze_image_templates-0.6.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "21ecccc06f7ce8c5bb25c69a3c0afc644ef9aa227dbdaabd1c77f596dda3a4a5",
"md5": "0653149cb1fceef611b5b1c3ef164a0b",
"sha256": "36450bc7c8fcdacd9f58206068ca0b1647dada42a819786ffba01b7850142055"
},
"downloads": -1,
"filename": "dolze_image_templates-0.6.1.tar.gz",
"has_sig": false,
"md5_digest": "0653149cb1fceef611b5b1c3ef164a0b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 8840247,
"upload_time": "2025-07-14T07:20:44",
"upload_time_iso_8601": "2025-07-14T07:20:44.444971Z",
"url": "https://files.pythonhosted.org/packages/21/ec/ccc06f7ce8c5bb25c69a3c0afc644ef9aa227dbdaabd1c77f596dda3a4a5/dolze_image_templates-0.6.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 07:20:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "dolze-templates",
"github_not_found": true,
"lcname": "dolze-image-templates"
}