chunky_png 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +14 -11
- data/{BENCHMARKING.md → BENCHMARKING.rdoc} +8 -8
- data/CHANGELOG.rdoc +236 -0
- data/{CONTRIBUTING.md → CONTRIBUTING.rdoc} +20 -9
- data/README.rdoc +15 -15
- data/chunky_png.gemspec +1 -1
- data/lib/chunky_png/color.rb +2 -2
- data/lib/chunky_png/version.rb +1 -1
- data/spec/chunky_png/vector_spec.rb +9 -9
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00c6b5bf5c682e05964783d8d05f964582c5f7aa
|
4
|
+
data.tar.gz: 8552180cbcd29adacd71df55a253d8a69a499e8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8ef6769e7d848d4fb526b2fa23710edc122c0ce67e9a4cabea9504faed8124cb1a667318ee61139282f91eb928c3aa7e745ba51308985f7713f050460ffa914
|
7
|
+
data.tar.gz: b04f411542d0bacf557ea6449abfa0a0d99406b8c26bb73b2b55fb7d275460c3b616c5a372e0a97dcb12eb44229a60a1bedbb260dedca77b216c261e0c374eee
|
data/.travis.yml
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
language: ruby
|
2
2
|
script: bundle exec rake
|
3
|
+
sudo: false
|
4
|
+
|
3
5
|
rvm:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
- "1.8"
|
7
|
+
- "1.9"
|
8
|
+
- "2.0"
|
9
|
+
- "2.1"
|
10
|
+
- "2.2"
|
11
|
+
- ruby-head
|
12
|
+
- rbx
|
13
|
+
- jruby-18mode
|
14
|
+
- jruby-19mode
|
15
|
+
|
13
16
|
matrix:
|
14
17
|
allow_failures:
|
15
|
-
|
16
|
-
|
18
|
+
- rvm: rbx
|
19
|
+
- rvm: ruby-head
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
= ChunkyPNG benchmark suite
|
2
2
|
|
3
3
|
I would like the performance of this library as good as possible, and I will
|
4
4
|
gladly accept changes to this library that improves performance.
|
@@ -17,22 +17,22 @@ make sure that the chunky_png is installed for all your interpreters.
|
|
17
17
|
|
18
18
|
rvm 1.8.7,1.9.3,rbx bundle exec rake benchmark N=10
|
19
19
|
|
20
|
-
|
20
|
+
== Results
|
21
21
|
|
22
22
|
What is a speed improvement on one interpreter doesn't necessarily mean the
|
23
23
|
performance will be better on other interpreters as well. Please make sure to
|
24
24
|
benchamrk different RUby interpreters. When it comes to different Ruby
|
25
25
|
interpreters, the priority is the performance on recent MRI versions.
|
26
26
|
|
27
|
-
Some very old benchmark result (using N=50) on my 2007 iMac can be
|
28
|
-
|
27
|
+
Some very old benchmark result (using <tt>N=50</tt>) on my 2007 iMac can be
|
28
|
+
found at https://gist.github.com/wvanbergen/495323.
|
29
29
|
|
30
|
-
|
30
|
+
== Why is this relevant?
|
31
31
|
|
32
32
|
ChunkyPNG is a pure Ruby library to handle PNG files. Decoding a PNG requires
|
33
33
|
a lot of integer math and bitwise operations, and moderate use of the unpack
|
34
|
-
method to read binary data. Encoding is a good test for
|
34
|
+
method to read binary data. Encoding is a good test for +Array#pack+, and
|
35
35
|
depending on the encoding options, also requires a lot of calculations.
|
36
36
|
Therefore, the library is a good benchmark candidate for these methods and
|
37
|
-
algorithms. It has been used to improve the
|
38
|
-
methods in Rubinius.
|
37
|
+
algorithms. It has been used to improve the <tt>Array#pack</tt> and
|
38
|
+
<tt>String#unpack</tt> methods in Rubinius.
|
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,236 @@
|
|
1
|
+
= Changelog
|
2
|
+
|
3
|
+
The file documents the changes to this library over the different versions.
|
4
|
+
|
5
|
+
- ChunkyPNG uses semantic versioning. This means that the public API will not change except for major versions.
|
6
|
+
- Please add an entry to the "Unreleased changes" section in your pull requests, so I can move them into a numbered version section on release.
|
7
|
+
|
8
|
+
=== Unreleased changes
|
9
|
+
|
10
|
+
- Nothing yet!
|
11
|
+
|
12
|
+
=== 1.3.4 - 2015-02-16
|
13
|
+
|
14
|
+
- Assert compatibility with Ruby 2.2
|
15
|
+
- Improved documentation using RDoc, so it is included on http://www.rubydoc.info/gems/chunky_png
|
16
|
+
- Update chunkypng.com website; migrate some stuff from the wiki.
|
17
|
+
|
18
|
+
=== 1.3.3 - 2014-10-24
|
19
|
+
|
20
|
+
- Improve performance of <tt>Canvas#crop</tt> and <tt>Canvas#crop!</tt> by doing less memory allocations.
|
21
|
+
- Update to RSPEC 3
|
22
|
+
- Add CONTRIBUTING.rdoc file.
|
23
|
+
|
24
|
+
=== 1.3.2 - 2014-10-18
|
25
|
+
|
26
|
+
- Add HSV/HSL color conversions: <tt>Color.from_hsl</tt>, <tt>Color.to_hsl</tt>
|
27
|
+
- Allow empty IDAT chunks to better conform to the PNG standard.
|
28
|
+
- Small bugfix in image resampling.
|
29
|
+
- Documentation and code readability improvements.
|
30
|
+
|
31
|
+
=== 1.3.1 - 2014-04-28
|
32
|
+
|
33
|
+
- Improve performance of <tt>Palette.from_canvas</tt>.
|
34
|
+
- Add <tt>Color.euclidean_distance_rgba</tt> to compare colors.
|
35
|
+
- Bugix in <tt>Canvas.from_bgr_stream</tt>.
|
36
|
+
- Documentation and code readibility improvements.
|
37
|
+
- README updates, include mention of screencast.
|
38
|
+
|
39
|
+
=== 1.3.0 - 2014-02-10
|
40
|
+
|
41
|
+
- Add support for parsing color that use three-hex notation. (e.g. <tt>#aaa</tt> instead of <tt>#aaaaaa</tt>)
|
42
|
+
- Add <tt>Canvas#border!</tt> and <tt>Canvas#border</tt> to draw a border around a canvas.
|
43
|
+
- Add <tt>Canvas#trim!</tt> and <tt>Canvas#trim</tt> to trim a border from a canvas.
|
44
|
+
|
45
|
+
=== 1.2.9 - 2013-10-17
|
46
|
+
|
47
|
+
- Set license in chunky_png.gemspec for better discoverability.
|
48
|
+
- Improve error messages for <tt>Canvas#crop</tt>.
|
49
|
+
- Use better gem release management tasks from bundler.
|
50
|
+
|
51
|
+
=== 1.2.8 - 2013-03-30
|
52
|
+
|
53
|
+
- Ruby 2.0 compatibility.
|
54
|
+
- Fixed some encoding issues on JRuby.
|
55
|
+
- Update Travis CI configuration to test on more Ruby versions.
|
56
|
+
|
57
|
+
=== 1.2.7 - 2013-01-07
|
58
|
+
|
59
|
+
- Small PNG decoding performnace improvements by using bitwise math.
|
60
|
+
|
61
|
+
=== 1.2.6 - 2012-08-07
|
62
|
+
|
63
|
+
- Add decompression bomb security warning to README.
|
64
|
+
- Fix RMagick loading issue on case sensitive filesystems.
|
65
|
+
- Some compatibility fixes for the upcoming Ruby 2.0.
|
66
|
+
- Allow more data-url notations for <tt>ChunkyPNG::Canvas.from_data_url</tt>.
|
67
|
+
|
68
|
+
=== 1.2.5 - 2011-09-23
|
69
|
+
|
70
|
+
- Edge case bugfix in <tt>Color.decompose_alpha_component</tt> that could get triggered in the <tt>change_theme_color! </tt> method.
|
71
|
+
|
72
|
+
=== 1.2.4 - 2011-09-14
|
73
|
+
|
74
|
+
- Added data URL importing <tt>Canvas.from_data_url</tt>.
|
75
|
+
|
76
|
+
=== 1.2.3 - 2011-09-14
|
77
|
+
|
78
|
+
- Added data URL exporting <tt>Canvas#to_data_url</tt> to easily use PNGs inline in CSS or HTML.
|
79
|
+
|
80
|
+
=== 1.2.2 - 2011-09-14
|
81
|
+
|
82
|
+
- Workaround for performance bug in REE.
|
83
|
+
|
84
|
+
=== 1.2.1 - 2011-08-10
|
85
|
+
|
86
|
+
- Added bicubic resampling of images.
|
87
|
+
- Update resampling code to use integer math instead of floating points.
|
88
|
+
|
89
|
+
=== 1.2.0 - 2011-05-08
|
90
|
+
|
91
|
+
- Properly read PNG files with a tRNS chunk in color mode 0 (grayscale) or 2 (true color).
|
92
|
+
|
93
|
+
=== 1.1.2 - 2011-05-06
|
94
|
+
|
95
|
+
- Added <tt>Color.to_grayscale</tt> and <tt>Canvas#grayscale!</tt> to convert colors and canvases to grayscale.
|
96
|
+
- Memory footprint improvement of <tt>Canvas#resample!</tt>
|
97
|
+
|
98
|
+
=== 1.1.1 - 2011-04-22
|
99
|
+
|
100
|
+
- Added <tt>Canvas#to_alpha_channel_bytes</tt> and <tt>Canvas#to_grayscale_stream</tt> to export raw pixel data.
|
101
|
+
- Spec suite cleanup
|
102
|
+
|
103
|
+
=== 1.1.0 - 2011-03-19
|
104
|
+
|
105
|
+
- Add bezier curve drawing: <tt>Canvas#bezier_curve</tt>.
|
106
|
+
- RDoc fixes & improvements.
|
107
|
+
|
108
|
+
=== 1.0.1 - 2011-03-08
|
109
|
+
|
110
|
+
- Performance improvements.
|
111
|
+
|
112
|
+
=== 1.0.0 - 2011-03-06
|
113
|
+
|
114
|
+
There are some API changes for this release. If you are using <tt>Canvas#compose</tt> or <tt>Canvas#replace</tt>, these methods will no longer operate in place, but will return a new canvas instance instead. The in place versions have been renamed to <tt>compose!</tt> and <tt>replace!</tt> to be more consistent with the rest of the API.
|
115
|
+
|
116
|
+
- Added image resampling using the nearest neighbor algorithm: <tt>Canvas#resample</tt>.
|
117
|
+
- Added circle and polygon drawing methods: <tt>Canvas#circle</tt> and <tt>Canvas#polygon</tt>.
|
118
|
+
- Added in place version of <tt>Canvas#crop</tt>, <tt>Canvas#rotate_180</tt>, <tt>Canvas#flip_horizontally</tt> and <tt>Canvas#flip_vertically</tt>. Just add a bang to the method name (e.g. <tt>Canvas#crop!</tt>) and it will change the current canvas instead of returning a new one. These implementations are also more memory and CPU efficient.
|
119
|
+
- Added geometry helper classes: <tt>ChunkyPNG::Point</tt>, <tt>ChunkyPNG::Dimension</tt> and <tt>ChunkyPNG::Vector</tt>.
|
120
|
+
- Added a list of HTML named colors. Get them by calling <tt>ChunkyPNG::Color(:teal)</tt> or <tt>ChunkyPNG::Color('red @ 0.8')</tt>
|
121
|
+
- Added encoding support for 1-, 2-, and 4-bit grayscale images.
|
122
|
+
- Cleaned up auto-detection of color mode settings. It will now choose 1 bit grayscale mode if an image only contains black and white. (The other low bitrate grayscale modes are never chosen automatically.)
|
123
|
+
- RDoc improvements. See http://rdoc.info/gems/chunky_png/frames.
|
124
|
+
- ChunkyPNG is now also tested on Ruby 1.8.6.
|
125
|
+
|
126
|
+
=== 0.12.0 - 2010-12-12
|
127
|
+
|
128
|
+
- Added support for encoding indexed images with a low bitrate. It will automatically use less bits per pixel if possible.
|
129
|
+
- Improved testing setup. ChunkyPNG is now tested on Ruby 1.8.7, 1.9.2, JRuby and Rubinius.
|
130
|
+
|
131
|
+
=== 0.11.0 - 2010-11-16
|
132
|
+
|
133
|
+
- Decoding of 1, 2 and 4 bit indexed color images.
|
134
|
+
- Decoding of 1, 2 and 4 bit grayscale images.
|
135
|
+
- Decoding 16 bit images. The extra bits will be discarded, so the image will be loaded as 8 bit.
|
136
|
+
- Used the official PNG suite to build a more complete test suite.
|
137
|
+
|
138
|
+
=== 0.10.5 - 2010-10-21
|
139
|
+
|
140
|
+
- Bugfix: allow 256 instead of 255 colors for indexed images.
|
141
|
+
|
142
|
+
=== 0.10.4 - 2010-10-17
|
143
|
+
|
144
|
+
- Improved handling of binary encoding for strings in Ruby 1.9.
|
145
|
+
|
146
|
+
=== 0.10.3 - 2010-10-07
|
147
|
+
|
148
|
+
- Small fix to make grayscale use the B byte consistently.
|
149
|
+
|
150
|
+
=== 0.10.2 - 2010-10-04
|
151
|
+
|
152
|
+
- Another small fix for OilyPNG compatibility
|
153
|
+
|
154
|
+
=== 0.10.1 - 2010-10-03
|
155
|
+
|
156
|
+
- Small fix for OilyPNG compatibility
|
157
|
+
|
158
|
+
=== 0.10.0 - 2010-10-03
|
159
|
+
|
160
|
+
- Refactored decoding and encoding to work on binary strings instead of arrays of integers. This gives a nice speedup and uses less memory. Thanks to Yehuda Katz for the idea.
|
161
|
+
|
162
|
+
=== 0.9.2 - 2010-09-16
|
163
|
+
|
164
|
+
- Fixed an issue with interlaced images.
|
165
|
+
|
166
|
+
=== 0.9.1 - 2010-09-15
|
167
|
+
|
168
|
+
- Fixed image metadata issue when duplicating images.
|
169
|
+
|
170
|
+
=== 0.9.0 - 2010-08-18
|
171
|
+
|
172
|
+
- Added <tt>flip_horizontally</tt>, <tt>flip_vertically</tt>, <tt>rotate_left</tt>, <tt>rotate_right</tt> and <tt>rotate_180</tt> to <tt>ChunkyPNG::Canvas</tt>.
|
173
|
+
- Now raises <tt>ChunkyPNG::OutOfBounds</tt> exceptions when referencing coordinates outside the image bounds.
|
174
|
+
- Added Gemfile for development dependency management.
|
175
|
+
|
176
|
+
=== 0.8.0 - 2010-06-30
|
177
|
+
|
178
|
+
- Added <tt>ChunkyPNG::Image#rect</tt> to draw simple rectangles.
|
179
|
+
- Fixed composing a transparent color on a fully transparent background.
|
180
|
+
|
181
|
+
=== 0.7.3 - 2010-04-28
|
182
|
+
|
183
|
+
- Based on the suggestion of [Dirkjan Bussink](http://github.com/dbussink), introduced custom exception classes:
|
184
|
+
- <tt>ChunkyPNG::SignatureMismatch</tt> is raised when the PNG signature could not be found. Usually this means the the file is not a PNG image.
|
185
|
+
- <tt>ChunkyPNG::CRCMismatch</tt> is raised when the a CRC check for a chunk in the PNG file fails.
|
186
|
+
- <tt>ChunkyPNG::NotSupported</tt> is raised when the PNG image uses a feature that ChunkyPNG does not support.
|
187
|
+
- <tt>ChunkyPNG::ExpectationFailed</tt> is raised when a required expectation failed.
|
188
|
+
|
189
|
+
=== 0.7.2 - 2010-04-28 [YANKED]
|
190
|
+
|
191
|
+
=== 0.7.1 - 2010-03-23
|
192
|
+
|
193
|
+
- Some fixes for 32-bit systems.
|
194
|
+
|
195
|
+
=== 0.7.0 - 2010-03-15
|
196
|
+
|
197
|
+
- Added <tt>:best_compression</tt> saving routine to allow creating the smallest images possible.
|
198
|
+
- Added option to control Zlib compression level while saving.
|
199
|
+
|
200
|
+
=== 0.6.0 - 2010-02-25
|
201
|
+
|
202
|
+
- Added methods to easily create different color variants of an image with a color theme. See [[Images with a color theme]] for more information.
|
203
|
+
|
204
|
+
=== 0.5.8 - 2010-02-24
|
205
|
+
|
206
|
+
- Ruby 1.8.6 compatibility fixes
|
207
|
+
- Improved API documentation.
|
208
|
+
|
209
|
+
=== 0.5.5 - 2010-02-15
|
210
|
+
|
211
|
+
- Added alpha decomposition to extract a color mask from a themed image.
|
212
|
+
- Improved API documentation.
|
213
|
+
|
214
|
+
=== 0.5.4 - 2010-01-17
|
215
|
+
|
216
|
+
- Added <tt>point</tt> and <tt>line</tt> anti-aliased drawing functions.
|
217
|
+
|
218
|
+
=== 0.5.3 - 2010-01-16
|
219
|
+
|
220
|
+
- Removed last occurrences of floating math to speed up the library.
|
221
|
+
- Added importing of ABGR and BGR streams.
|
222
|
+
- Added exporting an image as ABGR stream.
|
223
|
+
|
224
|
+
=== 0.5.2 - 2010-01-15
|
225
|
+
|
226
|
+
- Ruby 1.9 compatibility fixes.
|
227
|
+
- Improved speed of PNG decoding.
|
228
|
+
- Bugfix in *average* scanline decoding filter.
|
229
|
+
|
230
|
+
=== 0.5.1 - 2010-01-15
|
231
|
+
|
232
|
+
- Added <tt>:fast_rgba</tt> and <tt>:fast_rgb</tt> saving routines, which yield a 1500% speedup when saving an image.
|
233
|
+
|
234
|
+
=== 0.5.0 - 2010-01-15
|
235
|
+
|
236
|
+
- Complete rewrite of the earlier versions, now including awesomeness and unicorns.
|
@@ -1,11 +1,12 @@
|
|
1
|
-
|
1
|
+
= Contributing to ChunkyPNG
|
2
2
|
|
3
3
|
I will gladly accept any contributions from anybody to improve this library. However, I like to keep
|
4
4
|
the scope and complexity of this project relatively small. This way, with the limited amount of time I
|
5
5
|
dedicate to this project, this library remains a solid piece of software that many people rely on in
|
6
6
|
their workflow.
|
7
7
|
|
8
|
-
|
8
|
+
|
9
|
+
== Project scope
|
9
10
|
|
10
11
|
The scope of this library is defined as:
|
11
12
|
|
@@ -16,21 +17,23 @@ The scope of this library is defined as:
|
|
16
17
|
I will close issues and pull requests that go beyond this scope. If you want to work on something,
|
17
18
|
but are not sure if it will be in scope, feel free to reach out to me!
|
18
19
|
|
19
|
-
|
20
|
+
|
21
|
+
== Reporting bugs
|
20
22
|
|
21
23
|
- First, see if somebody else has reported the problem already.
|
22
24
|
- Try to include as much relevant information as possible, so I can recreate the problem.
|
23
25
|
- If possible, include the PNG image that is causing the issue.
|
24
26
|
- If possible, include a code snippet that exposes the problem.
|
25
27
|
|
26
|
-
|
28
|
+
|
29
|
+
== Pull requests
|
27
30
|
|
28
31
|
Title and description:
|
29
32
|
|
30
|
-
- If you are not yet done, please include
|
33
|
+
- If you are not yet done, please include <tt>[WIP]</tt> in the title of your pull request.
|
31
34
|
- Explain why your changes are relevant in the description of your pull request.
|
32
35
|
- If your changes improve performance, include benchmark methodology and results in the PR.
|
33
|
-
See BENCHMARKING.
|
36
|
+
See BENCHMARKING.rdoc for more information.
|
34
37
|
|
35
38
|
Code:
|
36
39
|
|
@@ -42,9 +45,17 @@ Specs:
|
|
42
45
|
|
43
46
|
- Always include specs that test your changes, to prevent me from breaking your code later.
|
44
47
|
- If your specs use PNG files, try to keep them as small as possible to keep the test suite snappy.
|
45
|
-
- Make sure that the specs are passing for all Rubies on
|
48
|
+
- Make sure that the specs are passing for all Rubies on Travis CI: https://travis-ci.org/wvanbergen/chunky_png/
|
46
49
|
|
47
50
|
Misc:
|
48
51
|
|
49
|
-
- Add an entry to CHANGELOG.
|
50
|
-
- Do not change
|
52
|
+
- Add an entry to CHANGELOG.rdoc.
|
53
|
+
- Do not change <tt>ChunkyPNG::VERSION</tt>
|
54
|
+
|
55
|
+
|
56
|
+
== Releases
|
57
|
+
|
58
|
+
- Ensure the latest master is passing on Travis CI.
|
59
|
+
- Update <tt>CHANGELOG.rdoc</tt>
|
60
|
+
- Update <tt>ChunkyPNG::VERSION</tt>
|
61
|
+
- Run <tt>bundle exec rake release</tt>
|
data/README.rdoc
CHANGED
@@ -24,8 +24,8 @@ Issue tracker:: http://github.com/wvanbergen/chunky_png/issues
|
|
24
24
|
optimized saving routine.
|
25
25
|
* Interoperability with RMagick if you really have to.
|
26
26
|
|
27
|
-
Also, have a look at OilyPNG at http://github.com/wvanbergen/oily_png. OilyPNG is a
|
28
|
-
mixin module that implements some of the ChunkyPNG algorithms in C, which
|
27
|
+
Also, have a look at OilyPNG at http://github.com/wvanbergen/oily_png. OilyPNG is a
|
28
|
+
mixin module that implements some of the ChunkyPNG algorithms in C, which
|
29
29
|
provides a massive speed boost to encoding and decoding.
|
30
30
|
|
31
31
|
== Usage
|
@@ -43,31 +43,32 @@ provides a massive speed boost to encoding and decoding.
|
|
43
43
|
badge = ChunkyPNG::Image.from_file('no_ie_badge.png')
|
44
44
|
avatar.compose!(badge, 10, 10)
|
45
45
|
avatar.save('composited.png', :fast_rgba) # Force the fast saving routine.
|
46
|
-
|
46
|
+
|
47
47
|
# Accessing metadata
|
48
48
|
image = ChunkyPNG::Image.from_file('with_metadata.png')
|
49
49
|
puts image.metadata['Title']
|
50
50
|
image.metadata['Author'] = 'Willem van Bergen'
|
51
51
|
image.save('with_metadata.png') # Overwrite file
|
52
|
-
|
52
|
+
|
53
53
|
# Low level access to PNG chunks
|
54
54
|
png_stream = ChunkyPNG::Datastream.from_file('filename.png')
|
55
55
|
png_stream.each_chunk { |chunk| p chunk.type }
|
56
56
|
|
57
|
-
Also check out the
|
58
|
-
basic usage of the library
|
57
|
+
Also check out the screencast on the ChunkyPNG homepage by John Davison,
|
58
|
+
which illustrates basic usage of the library on the ChunkyPNG website:
|
59
|
+
http://chunkypng.com/
|
59
60
|
|
60
|
-
For more information, see the project wiki on
|
61
|
-
or the RDOC documentation on http://
|
61
|
+
For more information, see the project wiki on https://github.com/wvanbergen/chunky_png/wiki
|
62
|
+
or the RDOC documentation on http://www.rubydoc.info/gems/chunky_png/frames
|
62
63
|
|
63
64
|
== Security warning
|
64
65
|
|
65
|
-
ChunkyPNG is vulnerable to decompression bombs, which means that ChunkyPNG is vulnerable to
|
66
|
-
DOS attacks by running out of memory when loading a specifically crafted PNG file. Because
|
67
|
-
of the pure-Ruby nature of the library it is very hard to fix this problem in the library
|
66
|
+
ChunkyPNG is vulnerable to decompression bombs, which means that ChunkyPNG is vulnerable to
|
67
|
+
DOS attacks by running out of memory when loading a specifically crafted PNG file. Because
|
68
|
+
of the pure-Ruby nature of the library it is very hard to fix this problem in the library
|
68
69
|
itself.
|
69
70
|
|
70
|
-
In order to safely deal with untrusted images, you should make sure to do the image
|
71
|
+
In order to safely deal with untrusted images, you should make sure to do the image
|
71
72
|
processing using ChunkyPNG in a separate process, e.g. by using fork or a background
|
72
73
|
processing library.
|
73
74
|
|
@@ -77,8 +78,7 @@ The library is written by Willem van Bergen for Floorplanner.com, and released
|
|
77
78
|
under the MIT license (see LICENSE). Please contact me for questions or
|
78
79
|
remarks. Patches are greatly appreciated!
|
79
80
|
|
80
|
-
Please check out
|
81
|
-
to see what changed in all versions.
|
81
|
+
Please check out CHANGELOG.rdoc to see what changed in all versions.
|
82
82
|
|
83
|
-
P.S.: The name of this library is intentionally similar to Chunky Bacon and
|
83
|
+
P.S.: The name of this library is intentionally similar to Chunky Bacon and
|
84
84
|
Chunky GIF. Use Google if you want to know _why. :-)
|
data/chunky_png.gemspec
CHANGED
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.add_development_dependency('rspec', '~> 3')
|
41
41
|
|
42
42
|
s.rdoc_options << '--title' << s.name << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
|
43
|
-
s.extra_rdoc_files = ['README.rdoc']
|
43
|
+
s.extra_rdoc_files = ['README.rdoc', 'BENCHMARKING.rdoc', 'CONTRIBUTING.rdoc', 'CHANGELOG.rdoc']
|
44
44
|
|
45
45
|
s.files = `git ls-files`.split($/)
|
46
46
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
data/lib/chunky_png/color.rb
CHANGED
@@ -352,7 +352,7 @@ module ChunkyPNG
|
|
352
352
|
# this compositing function is used by default.
|
353
353
|
#
|
354
354
|
# @param [Integer] fg The foreground color.
|
355
|
-
# @param [Integer] bg The
|
355
|
+
# @param [Integer] bg The background color.
|
356
356
|
# @return [Integer] The composited color.
|
357
357
|
# @see ChunkyPNG::Color#compose_precise
|
358
358
|
def compose_quick(fg, bg)
|
@@ -374,7 +374,7 @@ module ChunkyPNG
|
|
374
374
|
# slower than the version based on integer math, that version is preferred.
|
375
375
|
#
|
376
376
|
# @param [Integer] fg The foreground color.
|
377
|
-
# @param [Integer] bg The
|
377
|
+
# @param [Integer] bg The background color.
|
378
378
|
# @return [Integer] The composited color.
|
379
379
|
# @see ChunkyPNG::Color#compose_quick
|
380
380
|
def compose_precise(fg, bg)
|
data/lib/chunky_png/version.rb
CHANGED
@@ -7,43 +7,43 @@ describe ChunkyPNG::Vector do
|
|
7
7
|
|
8
8
|
describe '#length' do
|
9
9
|
it "shopuld have 3 items" do
|
10
|
-
expect(subject.length).to eql
|
10
|
+
expect(subject.length).to eql(3)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#x_range' do
|
15
15
|
it "should get the right range of x values" do
|
16
|
-
expect(subject.x_range).to eql
|
16
|
+
expect(subject.x_range).to eql(1..4)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should find the minimum x-coordinate" do
|
20
|
-
expect(subject.min_x).to eql
|
20
|
+
expect(subject.min_x).to eql(1)
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should find the maximum x-coordinate" do
|
24
|
-
expect(subject.max_x).to eql
|
24
|
+
expect(subject.max_x).to eql(4)
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should calculate the width correctly" do
|
28
|
-
expect(subject.width).to eql
|
28
|
+
expect(subject.width).to eql(4)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe '#y_range' do
|
33
33
|
it "should get the right range of y values" do
|
34
|
-
expect(subject.y_range).to eql
|
34
|
+
expect(subject.y_range).to eql(3..6)
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should find the minimum x-coordinate" do
|
38
|
-
expect(subject.min_y).to eql
|
38
|
+
expect(subject.min_y).to eql(3)
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should find the maximum x-coordinate" do
|
42
|
-
expect(subject.max_y).to eql
|
42
|
+
expect(subject.max_y).to eql(6)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should calculate the height correctly" do
|
46
|
-
expect(subject.height).to eql
|
46
|
+
expect(subject.height).to eql(4)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chunky_png
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -61,12 +61,16 @@ executables: []
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files:
|
63
63
|
- README.rdoc
|
64
|
+
- BENCHMARKING.rdoc
|
65
|
+
- CONTRIBUTING.rdoc
|
66
|
+
- CHANGELOG.rdoc
|
64
67
|
files:
|
65
68
|
- ".gitignore"
|
66
69
|
- ".travis.yml"
|
67
70
|
- ".yardopts"
|
68
|
-
- BENCHMARKING.
|
69
|
-
-
|
71
|
+
- BENCHMARKING.rdoc
|
72
|
+
- CHANGELOG.rdoc
|
73
|
+
- CONTRIBUTING.rdoc
|
70
74
|
- Gemfile
|
71
75
|
- LICENSE
|
72
76
|
- README.rdoc
|
@@ -408,7 +412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
408
412
|
version: '0'
|
409
413
|
requirements: []
|
410
414
|
rubyforge_project:
|
411
|
-
rubygems_version: 2.
|
415
|
+
rubygems_version: 2.4.5
|
412
416
|
signing_key:
|
413
417
|
specification_version: 4
|
414
418
|
summary: Pure ruby library for read/write, chunk-level access to PNG files
|