Skip to main content

A library for processing images and saving layers as PSD

Project description

Image to PSD

A Python library for processing images and saving layers as PSD files.

Prerequisites

Make sure you have ImageMagick installed. You can install it using the following commands:

On Ubuntu/Debian:

sudo apt-get update
sudo apt-get install imagemagick

On macOS:

You can install ImageMagick using Homebrew:

brew install imagemagick

On Windows:

Download and install ImageMagick from the official website.

Installation

You can install the library using pip:

pip install image_to_psd

Usage

Here is a basic example of how to use the library:

from image_to_psd.processor import process_image

image_url = "https://example.com/image.jpg"
result = process_image(image_url, method_type=1, bandwidth=10, is_dynamic=1, num_colors=50)

Saving Individual Layers

You can also save the individual layers as separate PNG files by setting the save_layers parameter to True:

from image_to_psd.processor import process_image

image_url = "https://example.com/image.jpg"
result = process_image(image_url, method_type=1, bandwidth=10, is_dynamic=1, num_colors=50, save_layers=True)

Using a Local File

If you want to process a local image file, you can provide the file path instead of a URL:

from image_to_psd.processor import process_image

image_path = "/path/to/your/local/image.jpg"
result = process_image(image_path, method_type=1, bandwidth=10, is_dynamic=1, num_colors=50, save_layers=True)

Configuration

The process_image function takes the following parameters:

  • image_path (str): URL or local path to the image file.
  • method_type (int): Method type for processing (0 for default, 1 for custom).
  • bandwidth (int): Bandwidth parameter for MeanShift clustering (used if method_type is 1).
  • is_dynamic (int): Flag to use dynamic color extraction (1 for dynamic, 0 for predefined).
  • num_colors (int): Number of dominant colors to extract (used if is_dynamic is 1).
  • save_layers (bool): Flag to save individual layers as separate PNG files (default is False).

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image_to_psd-1.1.0.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

image_to_psd-1.1.0-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page