Class: PSD::Header

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/psd/header.rb

Overview

Describes the Header for the PSD file, which is the first section of the file.

Constant Summary collapse

MODES =

All of the color modes are stored internally as a short from 0-15. This is a mapping of that value to a human-readable name.

[
  'Bitmap',
  'GrayScale',
  'IndexedColor',
  'RGBColor',
  'CMYKColor',
  'HSLColor',
  'HSBColor',
  'Multichannel',
  'Duotone',
  'LabColor',
  'Gray16',
  'RGB48',
  'Lab48',
  'CMYK64',
  'DeepMultichannel',
  'Duotone16'
]

Instance Method Summary collapse

Instance Method Details

#heightObject

Height of the entire document in pixels.



57
58
59
# File 'lib/psd/header.rb', line 57

def height
  rows
end

#mode_nameObject

Get the human-readable color mode name.



43
44
45
46
47
48
49
# File 'lib/psd/header.rb', line 43

def mode_name
  if mode >= 0 && mode <= 15
    MODES[mode]
  else
    "(#{mode})"
  end
end

#widthObject

Width of the entire document in pixels.



52
53
54
# File 'lib/psd/header.rb', line 52

def width
  cols
end