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.
⨠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
- Clone the repository
git clone https://github.com/RasikhAli/Moon-Wallpaper-Generator.git cd moon-wallpaper-generator
- Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies
pip install -r requirements.txt
- Run the application
python app.py
- 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
- Select Dates: Choose two dates to compare moon phases
- Configure Options:
- Toggle phase information text
- Adjust background blur intensity
- Generate: Click "Generate Wallpaper" or press Ctrl+Enter
- Download: Click the download button to save your wallpaper
Star Map Backgrounds
- Enable Star Map: Check "Use star map as background"
- Enter Location: Type your city and country (e.g., "New York, USA")
- Choose Date: Select which date's sky to display
- Generate: The app will create an astronomically accurate star map
Advanced Features
Keyboard Shortcuts
Ctrl+Enter: Generate wallpaperEscape: 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
- Place background images in
static/directory - Modify the background selection logic in
create_wallpaper()
Styling Changes
- Edit
static/styles.cssfor 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
- First Run: Initial star map generation downloads ~100MB of astronomical data
- Caching: Location coordinates and star data are cached for faster subsequent runs
- Memory: Star map generation is memory-intensive; close other applications if needed
ð¤ Contributing
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Add tests (if applicable)
- Commit your changes
git commit -m "Add amazing feature"
- Push to your branch
git push origin feature/amazing-feature
- 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
- Issues: GitHub Issues
- Discussions: GitHub Discussions
ð Stats
Made with ð and â by Rasikh Ali
Create beautiful wallpapers that capture the magic of the cosmos!
Project Timeline
Technologies
External Links
Related Projects
Projects built with similar technologies.
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.
Qrgen
A premium, feature-rich QR Code Generator engineered with Python (Flask) and a pristine Glassmorphism frontend.
Examina Ai
Using AI, It transforms raw study materials into structured, verified examination sets with support for institutional export formats like Moodle XML.