Skip to content

hughbe/PhotoshopReader

Repository files navigation

PhotoshopReader

Swift library to read Photoshop PSD files.

Example Usage

Add the following line to your project's SwiftPM dependencies:

.package(url: "https://github.com/hughbe/PhotoshopReader", from: "1.0.0"),
import PhotoshopReader

let data = Data(contentsOfFile: "<path-to-file>.psdb")!
let document = try PhotoshopDocument(data: data)
print(document.header)
print(document.colorModeData)
for resource in document.imageResources.resources {
    let data = try ImageResourceBlockData(resource: resource)
    print("\(resource.id.hexString): \(resource.data.count) bytes")
}

if let layers = document.layerAndMaskInformation.layerInfo?.layers {
    for layer in layers {
        for additionalInformation in layer.additionalLayerInformation {
            let data = try AdditionalLayerInformationData(layer: additionalInformation)
            print("\(additionalInformation.key): \(additionalInformation.data.count) bytes")
        }
    }
}

About

Swift library to read Photoshop PSD files

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages