Class: AppInfo::PngUncrush
Defined Under Namespace
Classes: Error, FormatError, PngReader
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(filename) ⇒ PngUncrush
Returns a new instance of PngUncrush.
71
72
73
74
|
# File 'lib/app_info/png_uncrush.rb', line 71
def initialize(filename)
@io = PngReader.new(File.open(filename))
raise FormatError, 'not a png file' unless @io.png?
end
|
Class Method Details
.decompress(input, output) ⇒ Object
63
64
65
|
# File 'lib/app_info/png_uncrush.rb', line 63
def self.decompress(input, output)
new(input).decompress(output)
end
|
.dimensions(input) ⇒ Object
67
68
69
|
# File 'lib/app_info/png_uncrush.rb', line 67
def self.dimensions(input)
new(input).dimensions
end
|
Instance Method Details
#decompress(output) ⇒ Object
80
81
82
83
84
85
86
87
88
|
# File 'lib/app_info/png_uncrush.rb', line 80
def decompress(output)
content = _remap(_dump_sections)
return false unless content
write_file(output, content)
rescue Zlib::DataError
false
end
|
#dimensions ⇒ Object
76
77
78
|
# File 'lib/app_info/png_uncrush.rb', line 76
def dimensions
_dump_sections(dimensions: true)
end
|