class ChunkyPNG::Chunk::Physical

www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.pHYs<br><br>ratio for display of the image.
The Physical (pHYs) chunk specifies the intended pixel size or aspect

def self.read(type, content)

def self.read(type, content)
  ppux, ppuy, unit = content.unpack("NNC")
  unit = unit == 1 ? :meters : :unknown
  new(ppux, ppuy, unit)
end

def content

Returns:
  • (String) - The binary content that should be written to the datastream.
def content
  [ppux, ppuy, unit == :meters ? 1 : 0].pack("NNC")
end

def dpix

def dpix
  raise ChunkyPNG::UnitsUnknown, "the PNG specifies its physical aspect ratio, but does not specify the units of its pixels' physical dimensions" unless unit == :meters
  ppux * INCHES_PER_METER
end

def dpiy

def dpiy
  raise ChunkyPNG::UnitsUnknown, "the PNG specifies its physical aspect ratio, but does not specify the units of its pixels' physical dimensions" unless unit == :meters
  ppuy * INCHES_PER_METER
end

def initialize(ppux, ppuy, unit = :unknown)

def initialize(ppux, ppuy, unit = :unknown)
  raise ArgumentError, "unit must be either :meters or :unknown" unless [:meters, :unknown].member?(unit)
  super("pHYs")
  @ppux, @ppuy, @unit = ppux, ppuy, unit
end