Sha256: 11d94e3ed5d748ac98d19598a973ddd30b38312a1166af528a73c8e075d3bd78
Contents?: true
Size: 532 Bytes
Versions: 2
Compression:
Stored size: 532 Bytes
Contents
class FormatParser::PSDParser PSD_HEADER = [0x38, 0x42, 0x50, 0x53] include FormatParser::IOUtils def information_from_io(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::FileInformation.image( file_type: :psd, width_px: w, height_px: h, ) end FormatParser.register_parser_constructor self end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
format_parser-0.1.1 | lib/parsers/psd_parser.rb |
format_parser-0.1.0 | lib/parsers/psd_parser.rb |