Skip to content

PaintMyPoem is a Python tool that turns your poems into abstract art. It analyzes tone and imagery using NLP and sentiment analysis, then maps them to shapes and colors to create a visual representation.

License

Notifications You must be signed in to change notification settings

kayvour/PaintMyPoem

Repository files navigation

PaintMyPoem


📄 Full changelog → CHANGELOG.md A Python-based tool that transforms poems into abstract art using natural language processing and simple machine learning. Choose from multiple artistic styles to match your poem's mood!

📝 What It Does

  • Analyzes the mood and tone of the poem using NLP and sentiment analysis
  • Extracts keywords and emotional themes
  • NEW: Choose from 5 artistic styles - Vibrant, Minimalist, Ethereal, Bold, or Organic
  • Generates visual elements and color palettes to match the poem and selected style
  • Uses Unsplash API to add backgrounds (optional)
  • Creates abstract artwork using pygame, saves it as a .png image

🚀 Features

Core Analysis

  • Detects emotions using TextBlob or VADER
  • Extracts key themes using nltk
  • Matches emotion to color palettes
  • Places visual elements (shapes, patterns, swirls) based on poem keywords

🎨 Artistic Styles (NEW)

  • Vibrant: Bold colors, high contrast, energetic feel
  • Minimalist: Clean, simple shapes with limited color palette
  • Ethereal: Soft, dreamy with transparent layers and flowing shapes
  • Bold: High contrast, geometric shapes, strong visual impact
  • Organic: Natural, flowing shapes with earth-inspired colors
  • Auto-select: Automatically picks the best style based on poem emotion

Visual Generation

  • Generates original, soft, vibrant, and vintage art variants
  • Complete background image management with download and caching
  • Integration with Unsplash API for nature backgrounds (sky, forest, ocean, mountains, sunset)
  • Style-specific particle effects and visual elements
  • Dynamic element count and sizing based on selected style
  • Runs completely locally

⚙️ Getting Started

  1. Clone the repository:
git clone https://github.com/kayvour/paintmypoem.git
cd paintmypoem
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the script:
python main.py
  1. Choose your experience:
    • Select interactive mode for full features
    • Use demo mode with sample poems
    • Choose from 5 artistic styles or let the AI auto-select
    • Add backgrounds or use gradient-only mode

🧠 How It Works

  1. Poem Analysis: Sentiment analysis determines emotional tone (joy, sadness, anger, etc.)
  2. Keyword Extraction: Key themes and visual words are identified (stars, rain, fire, etc.)
  3. 🎨 Style Selection: Choose your preferred artistic style or let AI auto-select
  4. Visual Planning: Shapes, positions, and colors are mapped based on emotion, keywords, and style
  5. Background Selection: Optional nature backgrounds from Unsplash API
  6. Art Generation: Final artwork created using pygame with style-specific effects

Style Examples

  • Minimalist + Sad Poem = Clean circles, muted blues, few elements
  • Vibrant + Joyful Poem = Bold stars, bright yellows/oranges, many elements
  • Ethereal + Love Poem = Soft circles, transparent pinks, flowing particles
  • Bold + Angry Poem = Sharp triangles, high contrast reds, thick borders
  • Organic + Nature Poem = Flowing shapes, earth tones, atmospheric effects

🧰 Built With

  • Python 3
  • Natural Language Toolkit (nltk)
  • TextBlob / VADER Sentiment Analysis
  • pygame for art generation
  • Unsplash API for background images
  • Custom Style Presets System

📌 Notes

  • Works best with short to medium poems (4-12 lines)
  • Poetic imagery and emotion words improve output quality
  • Each style produces distinctly different visual results
  • Background images enhance the final artwork but are optional
  • The sample poems in the /sample poems folder were generated using ChatGPT for demonstration

🔮 Future Improvements

  • ✅ Add style presets
  • More detailed shape variations (fractals, splines, organic forms)
  • GUI version for drag-and-drop poem uploads
  • Custom style creator for advanced users
  • Integration with more background sources
  • Create an executable release (.exe) so users can run without installing Python
  • Optimize and test for longer poems with chunking/batching
  • Advanced sentiment analysis with transformer models
  • Animation mode for moving visualizations
  • Social media sharing integration

🤝 Contributing

Contributions are welcome! If you have suggestions, improvements, or bug fixes:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

For major changes, please open an issue to discuss first.

Ideas for Contributors

  • New artistic styles in styles.py
  • Additional shape types in art_generator.py
  • Enhanced keyword extraction patterns
  • New background sources or generation methods

📄 License

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


PaintMyPoem celebrates the union of poetry and code. Whether you're a writer exploring visual expression or a coder fascinated by creative applications, this project helps bring verse to life through generative art! 🎨✨

About

PaintMyPoem is a Python tool that turns your poems into abstract art. It analyzes tone and imagery using NLP and sentiment analysis, then maps them to shapes and colors to create a visual representation.

Topics

Resources

License

Stars

Watchers

Forks

Languages