Class: AppInfo::PngUncrush
- Inherits:
-
Object
- Object
- AppInfo::PngUncrush
- Defined in:
- lib/app_info/png_uncrush.rb
Overview
Decompress iOS Png image file.
Defined Under Namespace
Classes: FormatError, PngReader
Class Method Summary collapse
-
.decompress(input, output) ⇒ Boolean
Decompress crushed png file.
-
.dimensions(input) ⇒ Array<Integer>
get png dimensions.
Instance Method Summary collapse
-
#decompress(output) ⇒ Boolean
Decompress crushed png file.
-
#dimensions ⇒ Array<Integer>
get png dimensions.
-
#initialize(filename) ⇒ PngUncrush
constructor
A new instance of PngUncrush.
Constructor Details
#initialize(filename) ⇒ PngUncrush
Returns a new instance of PngUncrush.
85 86 87 88 |
# File 'lib/app_info/png_uncrush.rb', line 85 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) ⇒ Boolean
Decompress crushed png file.
74 75 76 |
# File 'lib/app_info/png_uncrush.rb', line 74 def self.decompress(input, output) new(input).decompress(output) end |
.dimensions(input) ⇒ Array<Integer>
get png dimensions
81 82 83 |
# File 'lib/app_info/png_uncrush.rb', line 81 def self.dimensions(input) new(input).dimensions end |
Instance Method Details
#decompress(output) ⇒ Boolean
Decompress crushed png file.
100 101 102 103 104 105 106 107 108 |
# File 'lib/app_info/png_uncrush.rb', line 100 def decompress(output) content = _remap(_dump_sections) return false unless content write_file(output, content) rescue Zlib::DataError # perhops thi is a normal png image file false end |
#dimensions ⇒ Array<Integer>
get png dimensions
93 94 95 |
# File 'lib/app_info/png_uncrush.rb', line 93 def dimensions _dump_sections(dimensions: true) end |