Sha256: 513850c90c84a7f387a5a1fc6852b055741385398225d2da4277a8b203f073b7
Contents?: true
Size: 568 Bytes
Versions: 32
Compression:
Stored size: 568 Bytes
Contents
class FormatParser::PSDParser include FormatParser::IOUtils PSD_HEADER = [0x38, 0x42, 0x50, 0x53] def call(io) io = FormatParser::IOConstraint.new(io) magic_bytes = safe_read(io, 4).unpack('C4') return unless magic_bytes == PSD_HEADER # We can be reasonably certain this is a PSD so we grab the height # and width bytes w, h = safe_read(io, 22).unpack('x10N2') FormatParser::Image.new( format: :psd, width_px: w, height_px: h, ) end FormatParser.register_parser self, natures: :image, formats: :psd end
Version data entries
32 entries across 32 versions & 1 rubygems