Module: PNG

Defined in:
lib/png.rb,
lib/png/version.rb,
ext/png/png.c

Defined Under Namespace

Classes: Decoder, Encoder, Meta

Constant Summary collapse

VERSION =
"0.7.0"

Class Method Summary collapse

Class Method Details

.decode(png, **opt) ⇒ Object



16
17
18
# File 'lib/png.rb', line 16

def decode(png, **opt)
  return PNG::Decoder.new(**opt) << png
end

.decode_file(path, **opt) ⇒ Object



20
21
22
# File 'lib/png.rb', line 20

def decode_file(path, **opt)
  return PNG.decode(IO.binread(path), **opt)
end

.encode(w, h, raw, **opt) ⇒ Object



24
25
26
# File 'lib/png.rb', line 24

def encode(w, h, raw, **opt)
  return PNG::Encoder.new(w, h, **opt) << raw
end

.encode_file(w, h, path, **opt) ⇒ Object



28
29
30
# File 'lib/png.rb', line 28

def encode_file(w, h, path, **opt)
  return PNG.encode(w, h, IO.binread(path), **opt)
end

.read_header(data) ⇒ Object



12
13
14
# File 'lib/png.rb', line 12

def read_header(data)
  return PNG::Decoder.new.read_header(data)
end