Rob Wu 01f03fe393 Optimize PNG compression in SVG backend on Node.js
Use the environment's zlib implementation if available to get
reasonably-sized SVG files when an XObject image is converted to PNG.
The generated PNG is not optimal because we do not use a PNG predictor.
Futher, when our SVG backend is run in a browser, the generated PNG
images will still be unnecessarily large (though the use of blob:-URLs
when available should reduce the impact on memory usage). If we want to
optimize PNG images in browsers too, we can either try to use a DEFLATE
library such as pako, or re-use our XObject image painting logic in
src/display/canvas.js. This potential improvement is not implemented by
this commit

Tested with:

- Node.js 8.1.3 (uses zlib)
- Node.js 0.11.12 (uses zlib)
- Node.js 0.10.48 (falls back to inferior existing implementation).
- Chrome 59.0.3071.86
- Firefox 54.0

Tests:

Unit test on Node.js:

```
$ gulp lib
$ JASMINE_CONFIG_PATH=test/unit/clitests.json node ./node_modules/.bin/jasmine --filter=SVG
```

Unit test in browser: Run `gulp server` and open
http://localhost:8888/test/unit/unit_test.html?spec=SVGGraphics

To verify that the patch works as desired,

```
$ node examples/node/pdf2svg.js test/pdfs/xobject-image.pdf
$ du -b svgdump/xobject-image-1.svg
 # ^ Calculates the file size. Confirm that the size is small
 #   (784 instead of 80664 bytes).
```
2017-07-10 18:56:57 +02:00
..
2013-05-31 14:13:23 -07:00
2013-03-11 10:23:47 -07:00
2016-04-11 08:02:06 -05:00
2013-11-03 07:29:29 -06:00
2013-07-11 13:33:29 -05:00
2013-11-18 07:48:06 -06:00
2013-11-13 13:45:59 -06:00
2015-10-04 15:45:24 +02:00
2016-04-11 08:02:06 -05:00
2013-10-13 19:55:42 +03:00
2011-06-23 09:10:06 -07:00
2013-12-16 18:39:17 -06:00
2013-12-16 18:39:17 -06:00
2013-12-16 18:39:17 -06:00
2013-12-16 18:39:17 -06:00
2011-12-12 21:42:39 -06:00
2012-03-10 19:12:33 -08:00
2015-11-06 10:55:43 -06:00
2013-11-01 19:05:17 -05:00
2012-10-13 14:21:59 -05:00
2012-12-14 12:44:39 -08:00
2013-02-28 22:32:43 +02:00
2013-11-02 17:07:13 -05:00
2013-08-11 10:35:56 +02:00
2013-12-19 18:38:44 +01:00
2014-03-18 14:10:44 +01:00
2014-04-10 19:22:13 -05:00
2014-04-11 09:55:39 -07:00
2014-04-17 07:52:33 -05:00
2014-06-03 08:56:16 -05:00
2014-09-09 08:29:31 -05:00
2014-12-17 22:46:47 +01:00
2014-12-18 21:26:02 +01:00
2014-12-17 22:42:06 +01:00
2015-02-10 00:16:54 +01:00
2015-11-03 09:03:08 -06:00
2017-01-10 16:42:43 +00:00
2016-04-11 08:02:06 -05:00
2017-04-10 16:18:08 -07:00
2017-04-05 15:17:38 -07:00
2011-08-30 22:32:56 -05:00
2014-01-27 20:35:51 -06:00
2015-09-05 12:51:05 +02:00
2015-10-16 18:54:18 +02:00
2015-10-16 18:54:18 +02:00
2013-06-30 03:52:30 +05:30
2011-08-06 14:41:18 -07:00
2012-01-11 20:14:49 -06:00
2013-12-16 18:39:17 -06:00
2011-06-26 09:15:33 -05:00
2011-12-18 17:28:25 -08:00
2012-03-17 17:35:04 -05:00
2011-10-04 16:18:39 +01:00
2011-06-23 09:10:06 -07:00
2013-02-15 03:53:34 +09:00
2014-09-03 21:57:57 +02:00
2012-01-17 20:50:49 -08:00