zopfli-bin 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63674942822e78467d0e3d68a61db475c7be9142
4
- data.tar.gz: 45d5b8aae32208679ac6d281132e347e58981d4f
3
+ metadata.gz: 0b88329045bac6c113438abfd0d7fea35219ec6c
4
+ data.tar.gz: fa8a3aba30289aa2ab16df5be80171039888e086
5
5
  SHA512:
6
- metadata.gz: 86fd31f446e81670b531573332fb75bfa6f0552c623efe3a63d112ba08a5529382b5844f4c18bc2a088c3daba02e549cd32356a77801bbb920b1f605a2af6c23
7
- data.tar.gz: f0d92e91854c5631e6d9836a6345226f04ce51fa5475e9fea5f9df9c702a5483b6c89f560796e0d4c75a022d0d390f0cf695b88155d31f2ec091e52eb1643d6c
6
+ metadata.gz: 524f35c4e29e016dbba3ac15dcf8dcc9f069a9b1a70bd5878438cb5abc3d26d64db9366291941524c58a831e8d99cebeccc7f5a6ff54fee729ca382865ec6275
7
+ data.tar.gz: 16c9f0c8472d4b5cc8ddb6db9ff8df7fc4cd2a3afb216e5f5a48b1f62f759e42281387213ae7be9eb5f65f61ad9578205d310d4fb55b17e4484324527404ae3e
data/.gitmodules CHANGED
@@ -1,3 +1,4 @@
1
1
  [submodule "vendor/zopfli"]
2
- path = vendor/zopfli
3
- url = https://code.google.com/p/zopfli/
2
+ path = vendor/zopfli
3
+ url = https://github.com/google/zopfli.git
4
+ ignore = dirty
data/Gemfile.lock CHANGED
@@ -13,13 +13,13 @@ GIT
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- addressable (2.3.6)
17
- ansi (1.4.3)
18
- awesome_print (1.2.0)
16
+ addressable (2.3.8)
17
+ ansi (1.5.0)
18
+ awesome_print (1.6.1)
19
19
  builder (3.2.2)
20
20
  celluloid (0.16.0)
21
21
  timers (~> 4.0.0)
22
- colorize (0.7.3)
22
+ colorize (0.7.7)
23
23
  descendants_tracker (0.0.4)
24
24
  thread_safe (~> 0.3, >= 0.3.1)
25
25
  docile (1.1.5)
@@ -28,22 +28,22 @@ GEM
28
28
  simplecov
29
29
  simplecov-console
30
30
  simplecov-html
31
- faraday (0.9.0)
31
+ faraday (0.9.1)
32
32
  multipart-post (>= 1.2, < 3)
33
- ffi (1.9.6)
34
- git (1.2.8)
35
- github_api (0.12.1)
33
+ ffi (1.9.8)
34
+ git (1.2.9.1)
35
+ github_api (0.12.3)
36
36
  addressable (~> 2.3)
37
37
  descendants_tracker (~> 0.0.4)
38
38
  faraday (~> 0.8, < 0.10)
39
- hashie (>= 3.2)
39
+ hashie (>= 3.3)
40
40
  multi_json (>= 1.7.5, < 2.0)
41
41
  nokogiri (~> 1.6.3)
42
42
  oauth2
43
43
  growl (1.0.3)
44
- hashie (3.3.1)
45
- highline (1.6.21)
46
- hirb (0.7.2)
44
+ hashie (3.4.2)
45
+ highline (1.7.2)
46
+ hirb (0.7.3)
47
47
  hitimes (1.2.2)
48
48
  jeweler (2.0.1)
49
49
  builder
@@ -53,48 +53,51 @@ GEM
53
53
  highline (>= 1.6.15)
54
54
  nokogiri (>= 1.5.10)
55
55
  rake
56
- jwt (1.0.0)
57
- listen (2.7.11)
58
- celluloid (>= 0.15.2)
56
+ rdoc
57
+ json (1.8.3)
58
+ jwt (1.5.0)
59
+ listen (2.10.1)
60
+ celluloid (~> 0.16.0)
59
61
  rb-fsevent (>= 0.9.3)
60
62
  rb-inotify (>= 0.9)
61
63
  micron (0.5.1)
62
64
  ansi
63
65
  easycov
64
66
  hitimes
65
- mini_portile (0.6.0)
66
- mixlib-shellout (1.4.0)
67
- multi_json (1.10.1)
67
+ mini_portile (0.6.2)
68
+ mixlib-shellout (2.1.0)
69
+ multi_json (1.11.1)
68
70
  multi_xml (0.5.5)
69
71
  multipart-post (2.0.0)
70
- nokogiri (1.6.3.1)
71
- mini_portile (= 0.6.0)
72
+ nokogiri (1.6.6.2)
73
+ mini_portile (~> 0.6.0)
72
74
  oauth2 (1.0.0)
73
75
  faraday (>= 0.8, < 0.10)
74
76
  jwt (~> 1.0)
75
77
  multi_json (~> 1.3)
76
78
  multi_xml (~> 0.5)
77
79
  rack (~> 1.2)
78
- rack (1.5.2)
79
- rake (10.3.2)
80
+ rack (1.6.4)
81
+ rake (10.4.2)
80
82
  rb-fchange (0.0.6)
81
83
  ffi
82
- rb-fsevent (0.9.4)
84
+ rb-fsevent (0.9.5)
83
85
  rb-inotify (0.9.5)
84
86
  ffi (>= 0.5.0)
85
- simplecov (0.9.1)
87
+ rdoc (4.2.0)
88
+ simplecov (0.10.0)
86
89
  docile (~> 1.1.0)
87
- multi_json (~> 1.0)
88
- simplecov-html (~> 0.8.0)
90
+ json (~> 1.8)
91
+ simplecov-html (~> 0.10.0)
89
92
  simplecov-console (0.2.0)
90
93
  colorize
91
94
  hirb
92
95
  simplecov
93
- simplecov-html (0.8.0)
94
- thread_safe (0.3.4)
96
+ simplecov-html (0.10.0)
97
+ thread_safe (0.3.5)
95
98
  timers (4.0.1)
96
99
  hitimes
97
- yard (0.8.7.4)
100
+ yard (0.8.7.6)
98
101
 
99
102
  PLATFORMS
100
103
  ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/ext/Makefile CHANGED
@@ -2,7 +2,7 @@
2
2
  .PHONY: vendor
3
3
 
4
4
  vendor:
5
- $(MAKE) -C ../vendor/zopfli -f Makefile
5
+ $(MAKE) -C ../vendor/zopfli -f Makefile zopfli zopflipng
6
6
 
7
7
  install:
8
8
  # NO-OP
data/lib/zopfli/bin.rb CHANGED
@@ -4,12 +4,26 @@ require "mixlib/shellout"
4
4
  module Zopfli
5
5
  class Bin
6
6
 
7
- PATH = File.expand_path("../../../vendor/zopfli/zopfli", __FILE__)
7
+ PATH = File.expand_path("../../../vendor/zopfli/zopfli", __FILE__)
8
+ PATH_PNG = File.expand_path("../../../vendor/zopfli/zopflipng", __FILE__)
8
9
 
9
- def self.available?
10
- File.exists?(PATH)
10
+ # Test if zopfli bin is available
11
+ #
12
+ # @param [String] file path to the binary to test
13
+ #
14
+ # @return [Boolean] true if available
15
+ def self.available?(file=PATH)
16
+ File.exists?(file) && File.executable?(file)
11
17
  end
12
18
 
19
+ # Compress the given file
20
+ #
21
+ # @param [String] filename file to compress
22
+ # @param [Boolean] overwrite whether or not to overwrite existing files
23
+ #
24
+ # @return [Boolean] true if zopfli command returned cleanly
25
+ #
26
+ # @raise [Exception] raises on failure
13
27
  def self.compress(filename, overwrite=false)
14
28
 
15
29
  if !available? then
@@ -30,5 +44,38 @@ module Zopfli
30
44
  return !cmd.error?
31
45
  end
32
46
 
47
+ # Compress the given png file with zopfli_png
48
+ #
49
+ # @param [String] filename png file to compress
50
+ # @param [String] dest destination file; if nil, will overwrite original
51
+ def self.compress_png(filename, dest=nil)
52
+
53
+ if !available?(PATH_PNG) then
54
+ raise "zopfli binary not found!"
55
+ end
56
+
57
+ if !File.exists?(filename) then
58
+ raise "File not found: #{filename}"
59
+ end
60
+
61
+ if dest.nil? || dest.empty? then
62
+ dest = filename
63
+ end
64
+
65
+ temp = Tempfile.new("zopfli-")
66
+ temp.close
67
+ cmd = Mixlib::ShellOut.new("#{PATH_PNG} #{filename} #{temp.path}")
68
+ cmd.run_command
69
+
70
+ if cmd.error? then
71
+ temp.unlink
72
+ err = cmd.stdout.empty?() ? cmd.stderr : cmd.stdout
73
+ raise "zopflipng failed: #{err}"
74
+ end
75
+
76
+ File.rename(temp.path, dest)
77
+ true
78
+ end
79
+
33
80
  end
34
81
  end
data/test/test.png ADDED
Binary file
@@ -30,4 +30,14 @@ class TestZopfliBin < Micron::TestCase
30
30
  assert cmd.stdout =~ /rubygems/
31
31
  end
32
32
 
33
+ def test_compress_png
34
+ assert Zopfli::Bin.available?(Zopfli::Bin::PATH_PNG)
35
+
36
+ file = File.expand_path("../test.png", __FILE__)
37
+ dest = "#{file}.2.png"
38
+ assert Zopfli::Bin.compress_png(file, dest)
39
+ assert File.exists?(dest)
40
+ File.unlink(dest)
41
+ end
42
+
33
43
  end
@@ -0,0 +1,24 @@
1
+ Want to contribute? Great! First, read this page (including the small print at the end).
2
+
3
+ ### Before you contribute
4
+ Before we can use your code, you must sign the
5
+ [Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
6
+ (CLA), which you can do online. The CLA is necessary mainly because you own the
7
+ copyright to your changes, even after your contribution becomes part of our
8
+ codebase, so we need your permission to use and distribute your code. We also
9
+ need to be sure of various other things—for instance that you'll tell us if you
10
+ know that your code infringes on other people's patents. You don't have to sign
11
+ the CLA until after you've submitted your code for review and a member has
12
+ approved it, but you must do it before we can put your code into our codebase.
13
+ Before you start working on a larger contribution, you should get in touch with
14
+ us first through the issue tracker with your idea so that we can help out and
15
+ possibly guide you. Coordinating up front makes it much easier to avoid
16
+ frustration later on.
17
+
18
+ ### Code reviews
19
+ All submissions, including submissions by project members, require review. We
20
+ use Github pull requests for this purpose.
21
+
22
+ ### The small print
23
+ Contributions made by corporations are covered by a different agreement than
24
+ the one above, the Software Grant and Corporate Contributor License Agreement.
@@ -5,3 +5,4 @@ Daniel Reed
5
5
  Huzaifa Sidhpurwala
6
6
  Péter Szabó
7
7
  Lode Vandevenne
8
+ Derek Buitenhuis
@@ -32,6 +32,11 @@ zopflipng:
32
32
  $(CC) $(ZOPFLILIB_SRC) $(CFLAGS) -c
33
33
  $(CXX) $(ZOPFLILIB_OBJ) $(LODEPNG_SRC) $(ZOPFLIPNGLIB_SRC) $(ZOPFLIPNGBIN_SRC) $(CFLAGS) -o zopflipng
34
34
 
35
+ # ZopfliPNG shared library
36
+ libzopflipng:
37
+ $(CC) $(ZOPFLILIB_SRC) $(CFLAGS) -fPIC -c
38
+ $(CXX) $(ZOPFLILIB_OBJ) $(LODEPNG_SRC) $(ZOPFLIPNGLIB_SRC) $(CFLAGS) -fPIC --shared -Wl,-soname,libzopflipng.so.1 -o libzopflipng.so.1.0.0
39
+
35
40
  # Remove all libraries and binaries
36
41
  clean:
37
42
  rm -f zopflipng zopfli $(ZOPFLILIB_OBJ) libzopfli*
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -536,7 +536,7 @@ static void AddLZ77Block(const ZopfliOptions* options, int btype, int final,
536
536
  unsigned d_lengths[32];
537
537
  unsigned ll_symbols[288];
538
538
  unsigned d_symbols[32];
539
- size_t detect_block_size = *outsize;
539
+ size_t detect_block_size;
540
540
  size_t compressed_size;
541
541
  size_t uncompressed_size = 0;
542
542
  size_t i;
@@ -27,16 +27,16 @@ The hash for ZopfliFindLongestMatch of lz77.c.
27
27
  #include "util.h"
28
28
 
29
29
  typedef struct ZopfliHash {
30
- int* head; /* Hash value to index of its most recent occurance. */
31
- unsigned short* prev; /* Index to index of prev. occurance of same hash. */
30
+ int* head; /* Hash value to index of its most recent occurrence. */
31
+ unsigned short* prev; /* Index to index of prev. occurrence of same hash. */
32
32
  int* hashval; /* Index to hash value at this index. */
33
33
  int val; /* Current hash value. */
34
34
 
35
35
  #ifdef ZOPFLI_HASH_SAME_HASH
36
36
  /* Fields with similar purpose as the above hash, but for the second hash with
37
37
  a value that is calculated differently. */
38
- int* head2; /* Hash value to index of its most recent occurance. */
39
- unsigned short* prev2; /* Index to index of prev. occurance of same hash. */
38
+ int* head2; /* Hash value to index of its most recent occurrence. */
39
+ unsigned short* prev2; /* Index to index of prev. occurrence of same hash. */
40
40
  int* hashval2; /* Index to hash value at this index. */
41
41
  int val2; /* Current hash value. */
42
42
  #endif
@@ -30,7 +30,7 @@ The output is tailored for DEFLATE: symbols that never occur, get a bit length
30
30
  of 0, and if only a single symbol occurs at least once, its bitlength will be 1,
31
31
  and not 0 as would theoretically be needed for a single symbol.
32
32
 
33
- frequencies: The amount of occurances of each symbol.
33
+ frequencies: The amount of occurrences of each symbol.
34
34
  n: The amount of symbols.
35
35
  maxbits: Maximum bit length, inclusive.
36
36
  bitlengths: Output, the bitlengths for the symbol prefix codes.
@@ -150,7 +150,7 @@ int main(int argc, char* argv[]) {
150
150
  }
151
151
  else if (StringsEqual(arg, "-h")) {
152
152
  fprintf(stderr,
153
- "Usage: zopfli [OPTION]... FILE\n"
153
+ "Usage: zopfli [OPTION]... FILE...\n"
154
154
  " -h gives this help\n"
155
155
  " -c write the result on standard output, instead of disk"
156
156
  " filename + '.gz'\n"
@@ -5165,16 +5165,8 @@ static void filterScanline(unsigned char* out, const unsigned char* scanline, co
5165
5165
  for(i = 0; i < length; i++) out[i] = scanline[i];
5166
5166
  break;
5167
5167
  case 1: /*Sub*/
5168
- if(prevline)
5169
- {
5170
- for(i = 0; i < bytewidth; i++) out[i] = scanline[i];
5171
- for(i = bytewidth; i < length; i++) out[i] = scanline[i] - scanline[i - bytewidth];
5172
- }
5173
- else
5174
- {
5175
- for(i = 0; i < bytewidth; i++) out[i] = scanline[i];
5176
- for(i = bytewidth; i < length; i++) out[i] = scanline[i] - scanline[i - bytewidth];
5177
- }
5168
+ for(i = 0; i < bytewidth; i++) out[i] = scanline[i];
5169
+ for(i = bytewidth; i < length; i++) out[i] = scanline[i] - scanline[i - bytewidth];
5178
5170
  break;
5179
5171
  case 2: /*Up*/
5180
5172
  if(prevline)
@@ -151,7 +151,6 @@ int main(int argc, char *argv[]) {
151
151
  std::string prefix = "zopfli_"; // prefix for output filenames
152
152
 
153
153
  std::vector<std::string> files;
154
- std::vector<char> options;
155
154
  for (int i = 1; i < argc; i++) {
156
155
  std::string arg = argv[i];
157
156
  if (arg[0] == '-' && arg.size() > 1 && arg[1] != '-') {
@@ -182,6 +181,8 @@ int main(int argc, char *argv[]) {
182
181
  int num = atoi(value.c_str());
183
182
  if (name == "--always_zopflify") {
184
183
  always_zopflify = true;
184
+ } else if (name == "--verbose") {
185
+ png_options.verbose = true;
185
186
  } else if (name == "--lossy_transparent") {
186
187
  png_options.lossy_transparent = true;
187
188
  } else if (name == "--lossy_8bit") {
@@ -291,7 +292,7 @@ int main(int argc, char *argv[]) {
291
292
  error = ZopfliPNGOptimize(origpng, png_options, true, &resultpng);
292
293
 
293
294
  if (error) {
294
- printf("Decoding error %i: %s\n", error, lodepng_error_text(error));
295
+ printf("Decoding error %u: %s\n", error, lodepng_error_text(error));
295
296
  }
296
297
 
297
298
  // Verify result, check that the result causes no decoding errors
@@ -19,7 +19,10 @@
19
19
 
20
20
  #include "zopflipng_lib.h"
21
21
 
22
+ #include <errno.h>
22
23
  #include <stdio.h>
24
+ #include <stdlib.h>
25
+ #include <string.h>
23
26
  #include <set>
24
27
  #include <vector>
25
28
 
@@ -29,6 +32,7 @@
29
32
 
30
33
  ZopfliPNGOptions::ZopfliPNGOptions()
31
34
  : lossy_transparent(false)
35
+ , verbose(false)
32
36
  , lossy_8bit(false)
33
37
  , auto_filter_strategy(true)
34
38
  , use_zopfli(true)
@@ -48,6 +52,7 @@ unsigned CustomPNGDeflate(unsigned char** out, size_t* outsize,
48
52
  ZopfliOptions options;
49
53
  ZopfliInitOptions(&options);
50
54
 
55
+ options.verbose = png_options->verbose;
51
56
  options.numiterations = insize < 200000
52
57
  ? png_options->num_iterations : png_options->num_iterations_large;
53
58
 
@@ -81,7 +86,7 @@ unsigned CustomPNGDeflate(unsigned char** out, size_t* outsize,
81
86
 
82
87
  // Returns 32-bit integer value for RGBA color.
83
88
  static unsigned ColorIndex(const unsigned char* color) {
84
- return color[0] + 256u * color[1] + 65536u * color[1] + 16777216u * color[3];
89
+ return color[0] + 256u * color[1] + 65536u * color[2] + 16777216u * color[3];
85
90
  }
86
91
 
87
92
  // Counts amount of colors in the image, up to 257. If transparent_counts_as_one
@@ -128,6 +133,7 @@ void LossyOptimizeTransparent(lodepng::State* inputstate, unsigned char* image,
128
133
  r = image[i * 4 + 0];
129
134
  g = image[i * 4 + 1];
130
135
  b = image[i * 4 + 2];
136
+ break;
131
137
  }
132
138
  }
133
139
  }
@@ -366,7 +372,7 @@ int ZopfliPNGOptimize(const std::vector<unsigned char>& origpng,
366
372
 
367
373
  if (error) {
368
374
  if (verbose) {
369
- printf("Decoding error %i: %s\n", error, lodepng_error_text(error));
375
+ printf("Decoding error %u: %s\n", error, lodepng_error_text(error));
370
376
  }
371
377
  return error;
372
378
  }
@@ -423,3 +429,64 @@ int ZopfliPNGOptimize(const std::vector<unsigned char>& origpng,
423
429
 
424
430
  return error;
425
431
  }
432
+
433
+ extern "C" void CZopfliPNGSetDefaults(CZopfliPNGOptions* png_options) {
434
+
435
+ memset(png_options, 0, sizeof(*png_options));
436
+ // Constructor sets the defaults
437
+ ZopfliPNGOptions opts;
438
+
439
+ png_options->lossy_transparent = opts.lossy_transparent;
440
+ png_options->lossy_8bit = opts.lossy_8bit;
441
+ png_options->auto_filter_strategy = opts.auto_filter_strategy;
442
+ png_options->use_zopfli = opts.use_zopfli;
443
+ png_options->num_iterations = opts.num_iterations;
444
+ png_options->num_iterations_large = opts.num_iterations_large;
445
+ png_options->block_split_strategy = opts.block_split_strategy;
446
+ }
447
+
448
+ extern "C" int CZopfliPNGOptimize(const unsigned char* origpng,
449
+ const size_t origpng_size,
450
+ const CZopfliPNGOptions* png_options,
451
+ int verbose,
452
+ unsigned char** resultpng,
453
+ size_t* resultpng_size) {
454
+ ZopfliPNGOptions opts;
455
+
456
+ // Copy over to the C++-style struct
457
+ opts.lossy_transparent = !!png_options->lossy_transparent;
458
+ opts.lossy_8bit = !!png_options->lossy_8bit;
459
+ opts.auto_filter_strategy = !!png_options->auto_filter_strategy;
460
+ opts.use_zopfli = !!png_options->use_zopfli;
461
+ opts.num_iterations = png_options->num_iterations;
462
+ opts.num_iterations_large = png_options->num_iterations_large;
463
+ opts.block_split_strategy = png_options->block_split_strategy;
464
+
465
+ for (int i = 0; i < png_options->num_filter_strategies; i++) {
466
+ opts.filter_strategies.push_back(png_options->filter_strategies[i]);
467
+ }
468
+
469
+ for (int i = 0; i < png_options->num_keepchunks; i++) {
470
+ opts.keepchunks.push_back(png_options->keepchunks[i]);
471
+ }
472
+
473
+ const std::vector<unsigned char> origpng_cc(origpng, origpng + origpng_size);
474
+ std::vector<unsigned char> resultpng_cc;
475
+
476
+ int ret = ZopfliPNGOptimize(origpng_cc, opts, !!verbose, &resultpng_cc);
477
+ if (ret) {
478
+ return ret;
479
+ }
480
+
481
+ *resultpng_size = resultpng_cc.size();
482
+ *resultpng = (unsigned char*) malloc(resultpng_cc.size());
483
+ if (!(*resultpng)) {
484
+ return ENOMEM;
485
+ }
486
+
487
+ memcpy(*resultpng,
488
+ reinterpret_cast<unsigned char*>(&resultpng_cc[0]),
489
+ resultpng_cc.size());
490
+
491
+ return 0;
492
+ }
@@ -22,9 +22,17 @@
22
22
  #ifndef ZOPFLIPNG_LIB_H_
23
23
  #define ZOPFLIPNG_LIB_H_
24
24
 
25
+ #ifdef __cplusplus
26
+
25
27
  #include <string>
26
28
  #include <vector>
27
29
 
30
+ extern "C" {
31
+
32
+ #endif
33
+
34
+ #include <stdlib.h>
35
+
28
36
  enum ZopfliPNGFilterStrategy {
29
37
  kStrategyZero = 0,
30
38
  kStrategyOne = 1,
@@ -38,9 +46,54 @@ enum ZopfliPNGFilterStrategy {
38
46
  kNumFilterStrategies /* Not a strategy but used for the size of this enum */
39
47
  };
40
48
 
49
+ typedef struct CZopfliPNGOptions {
50
+ int lossy_transparent;
51
+ int lossy_8bit;
52
+
53
+ enum ZopfliPNGFilterStrategy* filter_strategies;
54
+ // How many strategies to try.
55
+ int num_filter_strategies;
56
+
57
+ int auto_filter_strategy;
58
+
59
+ char** keepchunks;
60
+ // How many entries in keepchunks.
61
+ int num_keepchunks;
62
+
63
+ int use_zopfli;
64
+
65
+ int num_iterations;
66
+
67
+ int num_iterations_large;
68
+
69
+ int block_split_strategy;
70
+ } CZopfliPNGOptions;
71
+
72
+ // Sets the default options
73
+ // Does not allocate or set keepchunks or filter_strategies
74
+ void CZopfliPNGSetDefaults(CZopfliPNGOptions *png_options);
75
+
76
+ // Returns 0 on success, error code otherwise
77
+ // The caller must free resultpng after use
78
+ int CZopfliPNGOptimize(const unsigned char* origpng,
79
+ const size_t origpng_size,
80
+ const CZopfliPNGOptions* png_options,
81
+ int verbose,
82
+ unsigned char** resultpng,
83
+ size_t* resultpng_size);
84
+
85
+ #ifdef __cplusplus
86
+ } // extern "C"
87
+ #endif
88
+
89
+ // C++ API
90
+ #ifdef __cplusplus
91
+
41
92
  struct ZopfliPNGOptions {
42
93
  ZopfliPNGOptions();
43
94
 
95
+ bool verbose;
96
+
44
97
  // Allow altering hidden colors of fully transparent pixels
45
98
  bool lossy_transparent;
46
99
  // Convert 16-bit per channel images to 8-bit per channel
@@ -76,4 +129,6 @@ int ZopfliPNGOptimize(const std::vector<unsigned char>& origpng,
76
129
  bool verbose,
77
130
  std::vector<unsigned char>* resultpng);
78
131
 
132
+ #endif // __cplusplus
133
+
79
134
  #endif // ZOPFLIPNG_LIB_H_
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/zopfli-bin.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: zopfli-bin 0.1.0 ruby lib
5
+ # stub: zopfli-bin 0.2.0 ruby lib
6
6
  # stub: ext/extconf.rb
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "zopfli-bin"
10
- s.version = "0.1.0"
10
+ s.version = "0.2.0"
11
11
 
12
12
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
13
  s.require_paths = ["lib"]
14
14
  s.authors = ["Chetan Sarva"]
15
- s.date = "2014-10-21"
15
+ s.date = "2015-06-18"
16
16
  s.description = "A thin wrapper around the zopfli binary (included and built as an ext)"
17
17
  s.email = "chetan@pixelcop.net"
18
18
  s.extensions = ["ext/extconf.rb"]
@@ -35,12 +35,22 @@ Gem::Specification.new do |s|
35
35
  "lib/zopfli-bin.rb",
36
36
  "lib/zopfli/bin.rb",
37
37
  "test/helper.rb",
38
+ "test/test.png",
38
39
  "test/test_zopfli-bin.rb",
40
+ "vendor/zopfli/CONTRIBUTING.md",
39
41
  "vendor/zopfli/CONTRIBUTORS",
40
42
  "vendor/zopfli/COPYING",
41
43
  "vendor/zopfli/Makefile",
42
44
  "vendor/zopfli/README",
43
45
  "vendor/zopfli/README.zopflipng",
46
+ "vendor/zopfli/blocksplitter.o",
47
+ "vendor/zopfli/cache.o",
48
+ "vendor/zopfli/deflate.o",
49
+ "vendor/zopfli/gzip_container.o",
50
+ "vendor/zopfli/hash.o",
51
+ "vendor/zopfli/katajainen.o",
52
+ "vendor/zopfli/lz77.o",
53
+ "vendor/zopfli/squeeze.o",
44
54
  "vendor/zopfli/src/zopfli/blocksplitter.c",
45
55
  "vendor/zopfli/src/zopfli/blocksplitter.h",
46
56
  "vendor/zopfli/src/zopfli/cache.c",
@@ -73,11 +83,17 @@ Gem::Specification.new do |s|
73
83
  "vendor/zopfli/src/zopflipng/zopflipng_bin.cc",
74
84
  "vendor/zopfli/src/zopflipng/zopflipng_lib.cc",
75
85
  "vendor/zopfli/src/zopflipng/zopflipng_lib.h",
86
+ "vendor/zopfli/tree.o",
87
+ "vendor/zopfli/util.o",
88
+ "vendor/zopfli/zlib_container.o",
89
+ "vendor/zopfli/zopfli",
90
+ "vendor/zopfli/zopfli_lib.o",
91
+ "vendor/zopfli/zopflipng",
76
92
  "zopfli-bin.gemspec"
77
93
  ]
78
94
  s.homepage = "http://github.com/chetan/zopfli-bin"
79
95
  s.licenses = ["MIT"]
80
- s.rubygems_version = "2.2.2"
96
+ s.rubygems_version = "2.4.6"
81
97
  s.summary = "A thin wrapper around the zopfli binary"
82
98
 
83
99
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zopfli-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chetan Sarva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-21 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -159,12 +159,22 @@ files:
159
159
  - lib/zopfli-bin.rb
160
160
  - lib/zopfli/bin.rb
161
161
  - test/helper.rb
162
+ - test/test.png
162
163
  - test/test_zopfli-bin.rb
164
+ - vendor/zopfli/CONTRIBUTING.md
163
165
  - vendor/zopfli/CONTRIBUTORS
164
166
  - vendor/zopfli/COPYING
165
167
  - vendor/zopfli/Makefile
166
168
  - vendor/zopfli/README
167
169
  - vendor/zopfli/README.zopflipng
170
+ - vendor/zopfli/blocksplitter.o
171
+ - vendor/zopfli/cache.o
172
+ - vendor/zopfli/deflate.o
173
+ - vendor/zopfli/gzip_container.o
174
+ - vendor/zopfli/hash.o
175
+ - vendor/zopfli/katajainen.o
176
+ - vendor/zopfli/lz77.o
177
+ - vendor/zopfli/squeeze.o
168
178
  - vendor/zopfli/src/zopfli/blocksplitter.c
169
179
  - vendor/zopfli/src/zopfli/blocksplitter.h
170
180
  - vendor/zopfli/src/zopfli/cache.c
@@ -197,6 +207,12 @@ files:
197
207
  - vendor/zopfli/src/zopflipng/zopflipng_bin.cc
198
208
  - vendor/zopfli/src/zopflipng/zopflipng_lib.cc
199
209
  - vendor/zopfli/src/zopflipng/zopflipng_lib.h
210
+ - vendor/zopfli/tree.o
211
+ - vendor/zopfli/util.o
212
+ - vendor/zopfli/zlib_container.o
213
+ - vendor/zopfli/zopfli
214
+ - vendor/zopfli/zopfli_lib.o
215
+ - vendor/zopfli/zopflipng
200
216
  - zopfli-bin.gemspec
201
217
  homepage: http://github.com/chetan/zopfli-bin
202
218
  licenses:
@@ -218,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
234
  version: '0'
219
235
  requirements: []
220
236
  rubyforge_project:
221
- rubygems_version: 2.2.2
237
+ rubygems_version: 2.4.6
222
238
  signing_key:
223
239
  specification_version: 4
224
240
  summary: A thin wrapper around the zopfli binary