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 ifmethod_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 ifis_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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file image_to_psd-1.1.0.tar.gz
.
File metadata
- Download URL: image_to_psd-1.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d560380e3de9f4155b3770239e95d4444ff4dce5c64ce6dbb509cf6722418d6 |
|
MD5 | 9a16ff2da33b6e5b655629e615abf35a |
|
BLAKE2b-256 | 16e3f605bb086d2c25d7317ed1bdc545282c8c554f3e9e674a19ac5c903a6c36 |
File details
Details for the file image_to_psd-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: image_to_psd-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8717482b04d9ed9db9a63e47860a429e34db9735133ab830a48d4092ea79199f |
|
MD5 | 7045704cf65d531add02dbd2dace6a5d |
|
BLAKE2b-256 | a16820917e53c4a9a24ac67d4df57cd7dbd9fc427076ceaad1285060619e9154 |