Skip to main content

Mini Photoshop Tool

Introduction

Major Features

  • Free and open source
  • Using SOTA models: U2Net and LaMa
  • Support 2 running option: library or web app
  • Support CPU and GPU (default: CPU)
  • Support: Background Removal and Object Removal (web app usage)

TODO

  • [] Support batch processing (for library usage)
  • [] Post processing for image smoothing
  • [] Optimize processing time with large image

Installation

pip install mini-photoshop

Library Usage

import cv2
import warnings
warnings.simplefilter('ignore')
from matplotlib import pyplot as plt

from mini_photoshop.model import InpaintModel, SalientModel


device = "cpu"
img_path = "PASTE IMAGE PATH HERE"
# model_name can be "u2net_lite", "u2net", "u2net_human_seg"
salient_model = SalientModel(model_name='u2net_lite', device=device)
inpaint_model = InpaintModel(device=device)

original_image = cv2.imread(img_path)
original_image = cv2.cvtColor(original_image, cv2.COLOR_BGR2RGB)
original_mask = salient_model(original_image)

# Create a copy of the image and set all background values to 255 (white)
bg_removed_result = original_image.copy()
bg_removed_result[original_mask == 0] = 255

inpaint_result = inpaint_model(original_image, original_mask*255)
inpaint_result = cv2.cvtColor(inpaint_result, cv2.COLOR_BGR2RGB)

fig, ax = plt.subplots(nrows=1, ncols=3, figsize=(20, 7))
ax[0].imshow(original_image)
ax[1].imshow(bg_removed_result)
ax[2].imshow(inpaint_result)
for a in ax:
    a.axis("off")
plt.show()

web app usage

Web App Usage

Run command

mini-photoshop

and then go to: http://localhost:8501/

web app usage

Metadata

Release files for mini-photoshop 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mini-photoshop 0.1.1
File Size Uploaded Provenance
mini-photoshop-0.1.1.tar.gz 10.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mini-photoshop 0.1.1
File Interpreter ABI Platform
mini_photoshop-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.1 kB

Release files / mini-photoshop-0.1.1.tar.gz

Download URL mini-photoshop-0.1.1.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2d31ba8c92afda7b227762c94821fa00cfba0e994d924546c9cfbb8de701c61b
BLAKE2b-256 checksum
How to use checksums
183374abe9ab19017593dd639435827923ef72b513853b6e4b7b070588b8659a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Release files / mini_photoshop-0.1.1-py3-none-any.whl

Download URL mini_photoshop-0.1.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1c3877c09426d28029c63a2c4ff112c6bc56ea671b886bff634e90051857cd6
BLAKE2b-256 checksum
How to use checksums
a7547cf91d6168852c62047f89dd2ef3d1b99f2be32cbee245560117dc4bd525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Security for mini-photoshop 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page