← projects

A png-to-psd Converter

2024AuthorPython

Overview

Pipeline that converts flat images into layered PSDs using segmentation masks from Meta’s Segment Anything Model and scripted GIMP integration.

Architecture

User uploads an image through a React frontend. The backend sends the image to SAM via Replicate to generate segmentation masks. Python processes these masks to reduce overlaps and extract layer candidates. The processed layers are then passed to a GIMP Script-Fu script, which assembles them into a PSD file and exports the result.

Implementation

Segmentation handled by SAM through Replicate API. Post-processing done in Python to clean and merge masks. GIMP scripting (Script-Fu in Scheme) used to programmatically construct layered images and export PSDs. Lightweight React UI for interaction.

Results

Produces PSD files with dozens of automatically generated layers from a single input image in ~1 minute. Demonstrates feasibility of automated image decomposition, but outputs are noisy, with overlapping and redundant layers requiring manual cleanup.

PythonSchemaReactGIMPSAM