JavaScriptJavaScript
PythonPython
CSSCSS
HTMLHTML
No Screenshots Uploaded Yet
COMPLETED

Moon Wallpaper Generator

A beautiful web application that creates stunning wallpapers featuring moon phases from any two dates, with optional astronomically accurate star map backgrounds. !Moon Phase Wallpaper Generator !Pyt

About the Project

A beautiful web application that creates stunning wallpapers featuring moon phases from any two dates, with optional astronomically accurate star map backgrounds.

Moon Phase Wallpaper Generator Python Flask Astronomy

✨ Features

🌕 Moon Phase Visualization

  • Dual Moon Display: Compare moon phases between any two dates
  • Real Moon Images: Fetches actual moon phase images from Lunaf.com
  • Phase Information: Displays phase names and illumination percentages
  • Enhanced Imagery: Automatic contrast and sharpness enhancement

🌌 Star Map Backgrounds

  • Astronomical Accuracy: Generate real star maps based on location and date
  • Global Coverage: Support for any location worldwide
  • Date Selection: Choose which date's sky to display
  • Hipparcos Catalog: Uses professional astronomical data
  • Beautiful Rendering: Realistic star sizes and brightness

🎨 Customization Options

  • Background Blur: Adjustable blur intensity (0-10)
  • Text Toggle: Optional phase information overlay
  • Neon Text Effects: Glowing text with multiple colors
  • High Resolution: 1080x1920 wallpaper output
  • Responsive Design: Works on all devices

🚀 User Experience

  • Intuitive Interface: Clean, modern design
  • Real-time Validation: Smart form validation
  • Progress Tracking: Visual progress indicators
  • Keyboard Shortcuts: Ctrl+Enter to generate
  • Location Suggestions: Autocomplete for major cities
  • Error Handling: Graceful fallbacks and user feedback

🛠️ Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Quick Start

  1. Clone the repository
git clone https://github.com/RasikhAli/Moon-Wallpaper-Generator.git
cd moon-wallpaper-generator
  1. Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Run the application
python app.py
  1. Open your browser Navigate to http://localhost:5000

📦 Dependencies

Core Framework

  • Flask: Web framework
  • Pillow (PIL): Image processing
  • requests: HTTP requests
  • BeautifulSoup4: HTML parsing

Astronomy Libraries

  • skyfield: Astronomical calculations
  • matplotlib: Star map visualization
  • geopy: Location geocoding
  • timezonefinder: Timezone detection
  • pytz: Timezone handling

Complete Requirements

Flask
Pillow
requests
beautifulsoup4
skyfield
matplotlib
geopy
timezonefinder
pytz
lxml

🎯 Usage

Basic Wallpaper Generation

  1. Select Dates: Choose two dates to compare moon phases
  2. Configure Options:
    • Toggle phase information text
    • Adjust background blur intensity
  3. Generate: Click "Generate Wallpaper" or press Ctrl+Enter
  4. Download: Click the download button to save your wallpaper

Star Map Backgrounds

  1. Enable Star Map: Check "Use star map as background"
  2. Enter Location: Type your city and country (e.g., "New York, USA")
  3. Choose Date: Select which date's sky to display
  4. Generate: The app will create an astronomically accurate star map

Advanced Features

Keyboard Shortcuts

  • Ctrl+Enter: Generate wallpaper
  • Escape: Clear alerts

Location Suggestions

The app provides autocomplete suggestions for major cities:

  • New York, USA
  • London, UK
  • Paris, France
  • Tokyo, Japan
  • Sydney, Australia
  • And many more...

Error Handling

  • Network Issues: Graceful fallbacks for moon data
  • Invalid Locations: Clear error messages
  • Astronomical Data: Automatic fallback to default backgrounds

🏗️ Project Structure

moon-wallpaper-generator/
├── app.py                 # Main Flask application
├── requirements.txt       # Python dependencies
├── README.md             # This file
├── .gitignore           # Git ignore rules
├── templates/
│   └── index.html       # Main HTML template
├── static/
│   ├── styles.css       # CSS styles
│   ├── scripts.js       # JavaScript functionality
│   └── *.png           # Generated wallpapers and star maps
└── venv/               # Virtual environment (created after setup)

🔧 Configuration

Environment Variables

# Optional: Set custom configuration
export FLASK_ENV=development
export FLASK_DEBUG=True

Customization Options

Default Settings

  • Wallpaper Size: 1080x1920 pixels
  • Moon Image Size: 750x750 pixels
  • Default Location: Lahore, Pakistan
  • Font Size: 48px
  • Star Magnitude Limit: 6 (visible to naked eye)

Modifying Defaults

Edit the constants in app.py:

WALLPAPER_SIZE = (1080, 1920)
MOON_IMAGE_SIZE = (750, 750)
DEFAULT_LOCATION = "Your City, Country"

🌟 API Endpoints

Generate Wallpaper

POST /generate
Content-Type: application/json

{
    "date1": "2024-01-15",
    "date2": "2024-02-15",
    "include_text": true,
    "background_blur": 2,
    "use_starmap": true,
    "starmap_date": "date1",
    "location": "New York, USA"
}

Download Wallpaper

GET /download/<filename>

Health Check

GET /health

🎨 Customization

Adding New Backgrounds

  1. Place background images in static/ directory
  2. Modify the background selection logic in create_wallpaper()

Styling Changes

  • Edit static/styles.css for visual customization
  • Modify color schemes using CSS variables
  • Adjust responsive breakpoints

Text Effects

  • Customize neon text colors in create_neon_text()
  • Modify font paths and sizes
  • Add new text positioning options

🐛 Troubleshooting

Common Issues

Star Map Generation Fails

Error: Failed to load astronomical data

Solution: Check internet connection. The app downloads astronomical data on first use.

Location Not Found

Error: Location 'XYZ' not found

Solution: Use format "City, Country" (e.g., "Paris, France")

Moon Data Unavailable

Error: Failed to fetch moon data

Solution: Check internet connection. The app will retry automatically.

Performance Tips

  1. First Run: Initial star map generation downloads ~100MB of astronomical data
  2. Caching: Location coordinates and star data are cached for faster subsequent runs
  3. Memory: Star map generation is memory-intensive; close other applications if needed

🤝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch
git checkout -b feature/amazing-feature
  1. Make your changes
  2. Add tests (if applicable)
  3. Commit your changes
git commit -m "Add amazing feature"
  1. Push to your branch
git push origin feature/amazing-feature
  1. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guidelines
  • Add docstrings to new functions
  • Test on multiple screen sizes
  • Ensure accessibility compliance

📄 License

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

🙏 Acknowledgments

  • Lunaf.com: Moon phase images and data
  • Skyfield: Astronomical calculations library
  • Hipparcos Catalog: Star position data
  • NASA JPL: Planetary ephemeris data (DE421)
  • OpenStreetMap: Location geocoding via Nominatim

🔗 Links

📊 Stats

GitHub stars GitHub forks GitHub issues GitHub license


Made with 🌙 and ⭐ by Rasikh Ali

Create beautiful wallpapers that capture the magic of the cosmos!

Project Timeline

Aug 2025 - Aug 2025

Technologies

JavaScriptPythonCSSHTML

External Links

Related Projects

Projects built with similar technologies.

Online Html Editor And Viewer
COMPLETED
JavaScriptHTMLCSS+1 more

Online Html Editor And Viewer

The Online HTML Editor and Viewer is a simple web application built with Flask that allows users to write and preview HTML code in real-time.

Rasikh Ali
Qrgen
COMPLETED
Jupyter NotebookHTMLPython

Qrgen

A premium, feature-rich QR Code Generator engineered with Python (Flask) and a pristine Glassmorphism frontend.

Rasikh Ali
Examina Ai
COMPLETED
TypeScriptPythonCSS+2 more

Examina Ai

Using AI, It transforms raw study materials into structured, verified examination sets with support for institutional export formats like Moodle XML.

Rasikh Ali