Building an Editable Layer Pipeline Around Qwen-Image 2.1 in Kokon
A developer has updated the local photo editor Kokon to version 0.12, introducing a 'Layers lab' that uses MobileSAM, matting models, and Qwen-Image 2.1 to separate image objects onto individual editable layers. The update also introduces a local server architecture with LAN support, an MCP server for AI agents, and optimized Apple Silicon backends. This clever pipeline demonstrates how developers can bypass the limitations of image models that lack native layer outputs, enabling advanced multi-layer photo editing entirely locally. It expands the utility of open-source models like Qwen-Image 2.1 for creative professionals and AI tool builders. The pipeline uses MobileSAM for initial masking, matting models or Qwen for edge refinement, and masked Qwen-Image edits to fill the background behind extracted objects. The application is open-source under AGPL, running on Windows, macOS, and Linux with hardware acceleration support for NVIDIA, Vulkan, and Apple Silicon.
## BACKGROUND
Qwen-Image 2.1 is an open-source unified text-to-image generation and image editing model developed by the Qwen team. MobileSAM is a lightweight, mobile-optimized version of Meta's Segment Anything Model designed for efficient real-time object masking.