Photoshop File Format
Sign in to saveAlso known as Photoshop document, .psd, PSD, Adobe Photoshop document
proprietary file format of Adobe System's Photoshop
Described at
""" Photoshop parser (.psd file). Creation date: 8 january 2006 Author: Victor Stinner """ from hachoir.parser import Parser from hachoir.field import (FieldSet, UInt16, UInt32, String, NullBytes, Enum, RawBytes) from hachoir.core.endian import BIG ENDIAN from hachoir.parser.image.photoshop metadata import Photoshop8BIM class Config(FieldSet): def init (self, args): FieldSet. init (self, args) self. size = (4 + self["size"].value) 8 def createFields(self): yield UInt32(self, "size") while not self.eof: yield Photoshop8BIM(self, "item[]") class PsdFile(Parser): endian = BIG ENDIAN PARSER TAGS = { "id": "psd", "category": "image", "file ext": ("psd",), "mime": ("image/psd", "image/photoshop", "image/x-photoshop"), "min size": 4 8, "magic": ((b"8BPS 0 1", 0),), "description": "Photoshop (PSD) picture", } COLOR MODE = { 0: "Bitmap", 1: "Grayscale", 2: "Indexed", 3: "RGB color", 4: "CMYK color", 7: "Multichannel", 8: "Duotone", 9: "Lab Color", } COMPRESSION NAME = { 0: "Raw data", 1: "RLE", } def validate(self): if self.stream.readBytes(0, 4) != b"8BPS": return "Invalid signature" return True def createFields(self): yield String(self, "signature", 4, "PSD signature (8BPS)", charset="ASCII") yield UInt16(self, "version") yield NullBytes(self, "reserved[]", 6) yield UInt16(self, "nb channels") yield UInt32(self, "width") yield UInt32(self, "height") yield UInt16(self, "depth") yield Enum(UInt16(self, "color mode"), self.COLOR MODE) Mode data yield UInt32(self, "mode data size") size = self["mode data size"].value if size: yield RawBytes(self, "mode data", size) Resources yield Config(self, "config") Reserved yield UInt32(self, "reserved data size") size = self["reserved data size"].value if size: yield RawBytes(self, "reserved data", size) yield Enum(UInt16(self, "compression"), self.COMPRESSION NAME) size = (self.size - self.current size) // 8 if size: yield RawBytes(self, "end", size)
Excerpt from a page describing this subject · 1,977 chars · not written by Vinony
Wikidata facts
- Subclass of
- proprietary file format
- Developer
- Adobe
Show 8 more facts
- file extension
- psd
- file format identification pattern
- 38425053
- media type
- image/vnd.adobe.photoshop
- short name
- PSD
- Mac OS type code
- 38 42 49 4d
- different from
- PSD
- Mac OS creator code
- 3842494D
Sources (8)
via Wikidata · CC0