Skip to content

actuallyrizzn/vupscaler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Venice AI Image Upscaler

A command-line tool for upscaling and enhancing images using the Venice AI API. This tool provides a simple interface to access Venice AI's powerful image upscaling and enhancement capabilities.

License

This project is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License - see the LICENSE file for details.

Features

  • Upscale images by 1x, 2x, or 4x
  • AI-powered image enhancement
  • Style transfer using text prompts
  • Automatic image resizing for large files
  • Detailed logging and error reporting
  • JSON output for programmatic use
  • Available as both Python script and Windows executable

Requirements

  • Python 3.6 or higher (for running from source)
  • Internet connection
  • Venice AI API key

Installation

Option 1: Using the Windows Executable

  1. Download the latest release from the releases page
  2. Extract the ZIP file
  3. Create a .env file in the same directory as the executable with your API key:
    VENICE_API_KEY=your_api_key_here
    
  4. Run venice-upscaler.exe directly

Option 2: Running from Source

  1. Clone this repository or download the source files
  2. Install required dependencies:
    pip install -r requirements.txt
  3. Create a .env file in the project root with your API key:
    VENICE_API_KEY=your_api_key_here
    

Building the Windows Executable

To build the Windows executable yourself:

  1. Install the requirements:

    pip install -r requirements.txt
  2. Create a .env file in the project root with your API key:

    VENICE_API_KEY=your_api_key_here
    
  3. Run the build script:

    python build.py
  4. The executable will be created in the build directory along with necessary documentation

Note: Building requires Windows and Python 3.6 or higher. The build process will create a build directory containing:

  • venice-upscaler.exe: The compiled executable
  • README.md: Documentation
  • requirements.txt: Python dependencies (for reference)

Configuration

The script uses environment variables for configuration:

  • VENICE_API_KEY: Your Venice AI API key (required)
  • Maximum file size: 4.5MB (automatically resizes larger images)
  • Default scale factor: 2x
  • Default enhancement creativity: 0.5
  • Default replication: 0.35

Usage

Using the Windows Executable

# Basic upscaling (2x)
venice-upscaler.exe image.jpg

# Custom scale factor
venice-upscaler.exe -s 4 image.jpg

# Enable enhancement
venice-upscaler.exe -e image.jpg

# Full enhancement with custom parameters
venice-upscaler.exe -e -c 0.8 -p "gold" -r 0.5 image.jpg

Using Python Script

# Basic upscaling (2x)
python upscale.py image.jpg

# Custom scale factor
python upscale.py -s 4 image.jpg

# Enable enhancement
python upscale.py -e image.jpg

# Full enhancement with custom parameters
python upscale.py -e -c 0.8 -p "gold" -r 0.5 image.jpg

Command Line Options

Option Short Description
--scale -s Scale factor (1.0, 2.0, or 4.0). Scale of 1.0 requires --enhance
--enhance -e Enable image enhancement during upscaling
--enhance-creativity -c Enhancement creativity level (0.0 to 1.0)
--enhance-prompt -p Text prompt for enhancement style
--replication -r Line and noise preservation level (0.0 to 1.0)
--verbose -v Enable verbose logging
--version Show version information

Enhancement Parameters

  • Enhancement Creativity (-c): Controls how much the AI can modify the image

    • 0.0: Minimal changes
    • 1.0: Maximum creative freedom
    • Default: 0.5
  • Enhancement Prompt (-p): Text description of desired style

    • Examples: "gold", "marble", "angry", "menacing"
    • Maximum length: 1500 characters
    • Optional
  • Replication (-r): Controls preservation of original image details

    • 0.0: Maximum preservation
    • 1.0: Maximum enhancement
    • Default: 0.35

Image Requirements

  • Minimum dimensions: 65536 pixels total
  • Maximum dimensions after scaling: 16777216 pixels
  • Supported formats: PNG, JPEG/JPG
  • Maximum file size: 4.5MB (larger files are automatically resized)

Output

The script outputs JSON responses for both success and failure cases:

Success example:

{
    "success": true,
    "output_path": "upscaled_image.jpg",
    "scale_factor": 2.0,
    "enhance": true,
    "enhance_creativity": 0.8,
    "enhance_prompt": "gold",
    "replication": 0.5
}

Error example:

{
    "success": false,
    "error": "Error message here"
}

Examples

Basic Upscaling

# 2x upscale
venice-upscaler.exe image.jpg

# 4x upscale
venice-upscaler.exe -s 4 image.jpg

Enhancement Only

# Enhance without upscaling
venice-upscaler.exe -s 1 -e image.jpg

# Enhance with gold style
venice-upscaler.exe -s 1 -e -p "gold" image.jpg

Full Enhancement

# Enhance with custom parameters
venice-upscaler.exe -e -c 0.8 -p "marble" -r 0.5 image.jpg

# 4x upscale with enhancement
venice-upscaler.exe -s 4 -e -c 0.7 -p "angry" image.jpg

Verbose Output

# Show detailed processing information
venice-upscaler.exe -v image.jpg

# Verbose with all options
venice-upscaler.exe -v -s 4 -e -c 0.7 -p "marble" image.jpg

Error Handling

The script handles various error conditions:

  • File not found
  • Invalid image dimensions
  • API errors
  • Invalid parameter combinations
  • File size limits
  • Missing API key

All errors are reported in JSON format with descriptive messages.

Logging

The script provides two levels of logging:

  1. Standard (default):

    • Basic progress information
    • Error messages
    • Success confirmations
  2. Verbose (-v):

    • Detailed API request information
    • Image processing details
    • Parameter validation
    • Response headers
    • Debug information

Limitations

  • Maximum input file size: 4.5MB (larger files are automatically resized)
  • Scale factors limited to 1.0, 2.0, or 4.0
  • Enhancement parameters limited to 0.0-1.0 range
  • Minimum image size: 65536 pixels
  • Maximum output size: 16777216 pixels

Troubleshooting

Common issues and solutions:

  1. API Error: 401 Unauthorized

    • Check your API key in the .env file
    • Ensure the .env file is in the correct location
    • Verify the API key is valid
  2. File too large

    • The script will automatically resize large files
    • Check the logs for resizing information
  3. Invalid dimensions

    • Ensure your image meets the minimum size requirement
    • Check the logs for dimension information
  4. Enhancement not working

    • Ensure you're using -e flag
    • For scale 1.0, enhancement is required
  5. Executable not working

    • Ensure you have the latest Visual C++ Redistributable installed
    • Try running from command prompt to see error messages
    • Check if your antivirus is blocking the executable
    • Verify the .env file exists and contains a valid API key

Contributing

Feel free to submit issues and enhancement requests!

License

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

About

Quick and dirty command line for Venice AI upscaling.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages