Skip to content

Instantly share code, notes, and snippets.

@ocornut
Last active December 4, 2024 17:55
Show Gist options
  • Save ocornut/52a4b9c679ed670851e7 to your computer and use it in GitHub Desktop.
Save ocornut/52a4b9c679ed670851e7 to your computer and use it in GitHub Desktop.

Last updated 2020/03/04

Some links from twitter on the topic of parsing PSD files (haven't looked into them in details). PSD include a flattened rasterized image so this is easy to load if that's the only thing you need. Most software / librairies have support for extracting this flattened data (e.g. stb_image.h does).

However if you want access to individual layers, render non-rasterized layers, emulate every photoshop features, extract or apply effects with more granularity, more code is needed. May range from easy to lots-of-work depending on what exactly you need.

As far as I know there isn't a trivial stb-like ready-to-use C++ library to do that sort of things. Posting all links here. Some are probably bloated or hard to use into your project, some lacking features.

TODO: Actually look into the pros/cons of all those.

Adobe Photoshop File Formats Specification (October 2013)
https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/

GIMP, Krita, ImageMagick are open-source software with some support for PSD features
http://www.gimp.org/
https://krita.org/
www.imagemagick.org/

DevIL (Developer's Image Library) support some PSD features
https://github.com/DentonW/DevIL
http://openil.sourceforge.net/

libpsd
https://github.com/alco/psdump/tree/master/libpsd-0.9

@donzanoid "that said many current psd source dists derive from this:"
http://telegraphics.com.au/sw/product/psdparse
http://telegraphics.com.au/svn/psdparse/trunk/

@donzanoid "this guy goes round the houses to use that source to do what you want, export layers to png"
https://github.com/Onglu/psdparser

@donzanoid "slightly simpler (one c/h) but not as feature complete"
https://github.com/ipkn/psdlite

psdslayer tool
http://jet.ro/2009/10/16/tool-update-psdslayer-1-1/

Molecular Matters' psd library SDK (possibly the best of this list, comes with sources, but at a cost)
http://molecular-matters.com/products_psd_sdk.html

Molecular Matter's psd extract tool
http://molecular-matters.com/products_psd_extract.html
March 2020: this is now open-source: https://github.com/MolecularMatters/psd_sdk

pixelprobe psd parser (Java)
https://android.googlesource.com/platform/tools/base/+/studio-master-dev/pixelprobe/src/main/java/com/android/tools/pixelprobe/decoder/psd/

Paint.NET PSD Plugin
https://psdplugin.codeplex.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment