Swift package · v0.1.0
KLSubjectVision
Create square subject or room thumbnails from a CGImage.
A synchronous thumbnail processor using Apple Vision, Core Image, and Core Graphics. It reports whether the result used a subject cutout, fallback, or room treatment.
Functions
- Vision foreground instance masks
- Aspect-fit cutout with explicit inset
- Aspect-fill room and fallback treatment
- Injectable extraction for deterministic tests
Not included
It processes CGImage values; it does not load platform images, schedule work, encode files, choose cache keys, or own attachment storage.
Install with SwiftPM
Package.swiftSwift
.package(url: "https://github.com/KoenLee1023/KLSubjectVision.git", from: "0.1.0")Usage
Integration exampleSwift
let output = SubjectThumbnailProcessor().process(
source,
request: .subject(pixelSize: 512, inset: 28)
)
guard let output else { return }
display(output.image, path: output.kind)API documentation
Open the complete API documentation.SubjectThumbnailProcessorTransforms one CGImage synchronously without shared mutable state.
SubjectThumbnailRequestSelects subject or room treatment with explicit pixel geometry.
SubjectThumbnailOutputReturns the square image and cutout, fallback, or room path.
Demo apps
Subject Studio
Compare injected cutout, forced fallback, and source geometry.
Thumbnail Matrix
Review sizes and treatments together as one policy system.