Commit graph

405 commits

Author SHA1 Message Date
Josh Holmer
0c2e3777b1 Refactor an if statement 2018-01-30 22:27:34 -05:00
Josh Holmer
348c7dbc56 Extract a function into a submodule 2018-01-30 22:21:31 -05:00
Josh Holmer
3497040b78 Remove useless annotation 2018-01-30 22:18:22 -05:00
Josh Holmer
cf5b90b444 Preallocate vector on reading in file
Provides 1.5% overall speedup on -o4
2018-01-30 22:15:03 -05:00
Josh Holmer
eb739c9ff9 Implement unix-specific permissions copying
Closes #4
2018-01-30 10:13:29 -05:00
Josh Holmer
ece85e6d15 Refactoring of internal code into smaller chunks.
There is still more to be done.
2018-01-30 09:35:03 -05:00
Josh Holmer
aa8b58628e Fix spacing of line breaks in the rendered documentation
Closes #94
2018-01-18 17:30:51 -05:00
Josh Holmer
e3ba535a79 Add some changes and fixes around how the output file is handled
See changelog for details
2018-01-10 20:54:15 -05:00
Josh Holmer
d204427f73 Refactor options presets 2018-01-10 11:22:52 -05:00
Josh Holmer
88f5bb0931 Hide modules from documentation, and only export structs used in options or return types 2018-01-10 10:37:01 -05:00
Josh Holmer
fe9fd95b21 Update some old documentation 2018-01-10 10:26:12 -05:00
Josh Holmer
32e3d245f9 Run latest rustfmt 2017-12-27 17:21:21 -05:00
Josh Holmer
bb6a2513eb Return exit code of 1 if error occurs while processing a file using the CLI
Closes #93
2017-12-27 17:20:12 -05:00
Josh Holmer
f8c62de6c0 Fix unfiltering of first scan line in each pass of an interlaced input file
Closes #92
2017-12-23 00:36:41 -05:00
Josh Holmer
4d62f9f7f9 Fix failure to optimize on certain grayscale images
Closes #89
2017-11-21 12:38:33 -05:00
Josh Holmer
9c7fdfd9d1 Fix parsing of glob paths on Windows
Closes #90
2017-11-06 19:01:18 -05:00
Josh Holmer
fa334e0750 Update dependencies 2017-11-06 18:50:10 -05:00
Emiel Beinema
b417e2bde7 Return an error when an APNG header is encountered 2017-09-30 23:50:52 +02:00
Emiel Beinema
4711cd6620 Check header of file before loading it in memory 2017-09-27 14:22:33 +02:00
Josh Holmer
e17f911334 Fix a bug in palette reduction at less than 8 bits per pixel
Closes #82
2017-09-11 18:27:28 -04:00
Josh Holmer
e3a26b77a4 Fix a bug in reducing palettes with a bit depth of two
Closes #80
2017-09-10 23:26:39 -04:00
Josh Holmer
0db03c6faf Fix new clippy lints 2017-09-03 23:36:38 -04:00
Josh Holmer
ec65bf7676 Code cleanup 2017-07-26 07:57:13 -04:00
Josh Holmer
f41ef551d3 Enable option for multiple alpha transformations 2017-07-26 00:37:55 -04:00
Josh Holmer
413f1aac7c Automatically change transparent pixels to black 2017-07-24 08:47:27 -04:00
Josh Holmer
19405cabd6 Fix help text
Closes #70
2017-07-01 10:10:26 -04:00
SethDusek
cf3789564e Make error module public 2017-06-19 07:21:43 +05:00
Josh Holmer
5f4ddbb8f4 Upgrade dependencies 2017-06-14 18:28:07 -04:00
Josh Holmer
ed3b843dd2 Update rayon and itertools dependencies 2017-05-02 19:29:20 -04:00
Josh Holmer
84cf6b09c2 Run rustfmt since it updated to v0.8.0.
I don't really like the new changes, but we might as well follow along.
2017-03-08 11:14:33 -05:00
Josh Holmer
d18850ebab Ignore color reductions that would increase file size
Closes #61
2017-03-08 10:11:13 -05:00
Josh Holmer
6499933eab Don't write larger file if moving from interlaced to non-interlaced
Closes #62
2017-03-07 09:58:23 -05:00
Josh Holmer
848a73723e Minor changes from last commit 2017-03-06 22:20:11 -05:00
Josh Holmer
6c8e7d253d Verify images are correct before outputting them, and fix a bug in certain images
Closes #60
2017-03-06 20:16:28 -05:00
Josh Holmer
c79ba3ab8a Version 0.14.4 2017-02-26 22:53:23 -05:00
Josh Holmer
87810829ce Fix issues in transparency palette reduction and release version 0.14.3 2017-02-25 23:33:55 -05:00
Josh Holmer
44818a854b Fix two bugs in reducing palette and release version 0.14.2 2017-02-22 15:45:46 -05:00
Joshua Holmer
8e02aa8294 Remove zlib dependency, which broke with the new version of zlib 2017-02-21 21:45:53 -05:00
Josh Holmer
705d280f8b Fix warning when clippy not enabled 2017-02-19 10:43:46 -05:00
Josh Holmer
ce2d166de2 Allow cyclomatic complexity on parse_opts function, there's no reasonable way to split this up
Closes #26
2017-02-15 13:01:17 -05:00
Josh Holmer
8116d69c3c Minor optimizations 2017-01-10 08:11:10 -05:00
Josh Holmer
f4b643d54b Fix clippy lints, now that clippy is working again. Hooray! 2016-12-16 21:24:47 -05:00
Josh Holmer
7261fa3398 Release 0.13.0 2016-12-12 13:54:18 -05:00
Josh Holmer
2810316f4e Reduce certain headers when reducing color type
Fixes #52
2016-12-12 09:57:18 -05:00
Josh Holmer
33f1fad711 Minor refactoring 2016-12-03 15:18:11 -05:00
Joshua Holmer
bf341dd20f Fix clippy warnings 2016-12-01 22:33:38 -05:00
Josh Holmer
6d49d7b8f9 Implement zopfli compression, available as a CLI flag (-Z)
Improves compression by about 10% over DEFLATE, but takes a very long
time at the moment, so it is off by default.
2016-12-01 12:51:30 -05:00
Alice Atlas
7460ffac73 Fix for passing in filenames that contain commas
The versions of clap supported by oxipng default to allowing commas to be used as a delimiter for passing a series of values in a single physical command line argument, when parsing for a parameter that accepts multiple values. This prevents oxipng from accepting filenames containing commas (it splits them into segments separated by commas and treats each one as a separate path to a file to process, generally not finding any); this patch fixes this by disabling the delimiter behavior for the 'files' argument.
2016-09-19 18:13:24 -04:00
Josh Holmer
4977dd0948 Replace current Mutex-based threading with Rayon 2016-09-17 18:16:26 -04:00
Josh Holmer
f654cbeac4 Various minor changes 2016-09-09 21:55:47 -04:00
Josh Holmer
4da65aef3f Add clone derive for PngError 2016-09-09 08:05:24 -04:00
Josh Holmer
e0dfbf3533 Enable clippy with dev feature, and fix several clippy lints 2016-08-20 20:47:26 -04:00
Josh Holmer
dbc3d97513 Eliminate many clones 2016-08-19 23:42:04 -04:00
Josh Holmer
d99db3ad23 Convert results to return a PngError
Closes #44
2016-08-16 12:38:09 -04:00
Josh Holmer
3166285150 Allow using optimization presets from crate
Closes #43
2016-08-14 11:31:46 -04:00
Josh Holmer
58a36902f6 Fix tests 2016-08-03 08:27:45 -04:00
Josh Holmer
37c32b80ef Remove quickcheck, as it breaks tests against 1.6.0 2016-08-03 08:15:01 -04:00
Josh Holmer
64edc9110e Start using quickcheck and add inline hints 2016-07-30 23:14:36 -04:00
Josh Holmer
99da13bd8e Version 0.10.0 [ci skip] 2016-07-26 12:59:28 -04:00
Josh Holmer
fa2b5c4ae5 Remove conversion from palette to grayscale
Closes #45
2016-07-26 12:32:43 -04:00
Josh Holmer
29557a18e8 Version 0.9.0 2016-07-14 20:00:59 -04:00
Josh Holmer
7734a9ffff Use multiple threads to filter 2016-07-14 19:47:47 -04:00
Josh Holmer
7f9ad263ec Refactor code into modules 2016-07-14 11:10:10 -04:00
Josh Holmer
332c27c7d0 Significant refactoring using itertools 2016-07-14 08:10:25 -04:00
Joshua Holmer
2659776bd5 Fix issue for interlacing images smaller than 4px
Fixes #42
2016-05-25 23:10:44 -04:00
Joshua Holmer
223995b551 Version 0.8.1 [ci skip] 2016-05-13 22:12:27 -04:00
Joshua Holmer
ecc19ad5cd Fix bug where interlaced images with certain widths would fail to optimize 2016-05-13 22:11:45 -04:00
Joshua Holmer
1d39714b0f Fix several new clippy lints 2016-05-13 10:46:16 -04:00
Joshua Holmer
0ddd875c84 Document default values for Options struct [ci skip] 2016-05-06 10:10:34 -04:00
Joshua Holmer
8358f4f72d Version 0.8.0 [ci skip] 2016-05-06 10:00:02 -04:00
Joshua Holmer
566675f0b6 Improve documentation of private API [ci skip] 2016-05-05 15:44:03 -04:00
Joshua Holmer
042e3e2563 Fix new warnings from clippy 2016-05-05 13:40:24 -04:00
Toby Lawrence
bc7de9b734 Add documentation to new public methods for optimizing in-memory. 2016-05-05 12:21:31 -04:00
Toby Lawrence
2573b20966 Add support for optimizing PNGs loaded in-memory.
In keeping with being able to use oxipng as a library, this adds a way
for developers to optimize a PNG already in memory, instead of requiring
  it to exist on disk first.
2016-05-05 07:54:52 -04:00
Joshua Holmer
193e6496bd Version 0.7.0 2016-05-04 10:41:29 -04:00
Joshua Holmer
3a39b13acf Add option for changing number of threads at runtime
Closes #39
2016-05-04 10:37:45 -04:00
Joshua Holmer
e4cd9b85e7 Move default Options into impl Default in library 2016-05-04 10:09:26 -04:00
Joshua Holmer
aaf443fca7 Similarly optimize unfilter mode 2
Unfilter mode 1 can't benefit from this optimization
because it modifies and reads from the same line of data
2016-05-02 15:58:45 -04:00
Joshua Holmer
3652a69255 Optimize filter mode 1 2016-05-02 15:48:21 -04:00
Joshua Holmer
32c35596ea 25% speed improvement in filter mode 2 by using iter instead of for 2016-05-02 14:49:30 -04:00
Joshua Holmer
c0fddfe4e6 Minor compression improvement in interlaced images 2016-05-02 13:54:04 -04:00
Joshua Holmer
b8116dd3dd Version 0.6.0 [ci skip] 2016-05-02 09:40:37 -04:00
Joshua Holmer
a4a5953786 Implement --fix to fix CRC errors in PNG block headers
Closes #5
2016-05-02 09:25:48 -04:00
Joshua Holmer
08eb44ec1a Partially implement --preserve
Needs better implementation once stable Rust improves,
or perhaps see if there's a crate for this

Reference #4 but keep open
2016-04-29 23:37:27 -04:00
Joshua Holmer
73d477924e Merge branch 'master' of github.com:shssoichiro/oxipng 2016-04-22 13:37:41 -04:00
Joshua Holmer
2c3e35d8bb Moderately improve cyclomatic complexity 2016-04-22 13:31:59 -04:00
Joshua Holmer
fac83c023d Fix issue where output directory would not be created if it did not exist 2016-04-22 13:31:33 -04:00
Joshua Holmer
f3b8665278 Use miniz for compression strategies 0 and 1
Worst case (RGB/A images) it performs similarly to zlib
Best case (Indexed images) it performs 1-2 orders of magnitude better

Zlib is kept for strategies 2 and 3, where it performs an order of
magnitude better than miniz
2016-04-20 23:14:41 -04:00
Joshua Holmer
11308959fa Version 0.5.0 [ci skip] 2016-04-20 15:51:14 -04:00
Joshua Holmer
3f3fbb6f60 Don't report pretend mode if verbosity is set to none 2016-04-19 22:38:34 -04:00
Joshua Holmer
2e7bfa4ebc Add palette reduction
Closes #11
2016-04-13 23:16:32 -04:00
Joshua Holmer
ea484a8978 Version 0.4.0 2016-04-08 13:52:15 -04:00
Joshua Holmer
c78e3213d6 Update crates and fix interlacing issue 2016-04-08 13:37:00 -04:00
Josh Holmer
e9c44cbc0b Add -s as alias for --strip safe
Fixes #31
2016-04-08 11:56:51 -04:00
Joshua Holmer
1d0ce6fca8 Performance optimizations
Interlacing performance increased by about 50%
Various other minor optimizations throughout the program
2016-04-05 12:08:47 -04:00
Joshua Holmer
9302caed59 Optimize filter mode 5 SAD loop 2016-04-05 10:52:02 -04:00
Joshua Holmer
548c69cad7 Version 0.3.0 [ci skip] 2016-04-04 20:23:24 -04:00
Joshua Holmer
1fc81ef683 Support interlaced files and allow conversion between interlaced and progressive files
Closes #3
2016-04-04 16:07:46 -04:00
Joshua Holmer
2974bbbee3 Fix issue with very small images [ci skip] 2016-04-04 11:06:00 -04:00
Joshua Holmer
7280ca80ce Fix issues with 2-bit and 1-bit per pixel interlaced images [ci skip] 2016-03-30 21:42:33 -04:00
Joshua Holmer
5740867be5 Work on implementing interlacing [ci skip] 2016-03-29 22:44:21 -04:00
Joshua Holmer
489964add2 Release v0.2.2 [ci skip] 2016-03-21 12:28:20 -04:00
Joshua Holmer
c1031b1ddd Merge branch 'master' of github.com:shssoichiro/oxipng 2016-03-21 12:15:09 -04:00
Joshua Holmer
85ea2c21e5 Remove FIXME sections from code
One section can't be improved from what I can gather,
because we have to iterate the number of bits per pixel in advance.

The output section has been refactored to pull the block writing code
into a separate function.

Fixes #19
2016-03-21 12:14:22 -04:00
Joshua Holmer
132a15403a Don't store intermediate copies of compressed image data unless it is current best.
Reduces peak memory usage significantly.
2016-03-19 10:42:03 -04:00
Joshua Holmer
87e21c2020 Limit number of simultaneous threads to help memory usage at high opt levels
Still uses a lot of memory. Would like to remove the storage of all compression
data attempts and calculate the best immediately during each thread.
2016-03-19 02:07:31 -04:00
Joshua Holmer
262bbf003a Release version 0.2.1 [ci skip] 2016-03-10 14:50:35 -05:00
Joshua Holmer
f1e65067f6 Improve best-filter-per-line heuristic used in filter mode 5
Fixes #16
2016-03-10 14:23:03 -05:00
Joshua Holmer
eba8062ba5 Add documentation to publicly visible areas of lib
Fixes #17
2016-03-08 11:59:37 -05:00
Joshua Holmer
911f51faa9 Version 0.2.0 [ci skip] 2016-03-05 22:55:01 -05:00
Joshua Holmer
b889c73a3b Make --strip option more versatile
Closes #22
2016-03-05 22:36:31 -05:00
Joshua Holmer
7d1e3a5bb9 Print console output to stderr instead of stdout
Makes it friendlier with --stdout option
See #20 for discussion
2016-03-04 16:37:40 -05:00
Joshua Holmer
0ae632c7f4 Revert "Enable quiet when stdout is selected"
This reverts commit 849d36ec6c.
2016-03-04 16:03:33 -05:00
Joshua Holmer
c6452beb12 Select compression and filter modes heuristically for -o1
Closes #21
2016-03-04 15:24:58 -05:00
Joshua Holmer
849d36ec6c Enable quiet when stdout is selected 2016-03-04 14:20:47 -05:00
SethDusek
d218d37944 Actually be quiet 2016-03-04 21:38:26 +05:00
Joshua Holmer
9a6379ac7e Fix version string from -V 2016-03-04 10:07:43 -05:00
Joshua Holmer
abedfc9c70 Each input file should output to its own file correctly
Fixes #15
2016-03-03 16:30:05 -05:00
Joshua Holmer
9a8c3f64b9 Fix alternative filter modes
Fixes #9
2016-03-03 13:52:52 -05:00
Joshua Holmer
3963f8da0a Prefer unreachable over panic where appropriate 2016-03-02 14:16:34 -05:00
Joshua Holmer
9fa55ae34a Fix all bit depth and color reduction tests
Closes #8
2016-03-02 12:40:56 -05:00
Joshua Holmer
6f1a87160a Fix all existing color reduction tests
Fixes #1
2016-02-23 13:28:39 -05:00
Joshua Holmer
d2cd105b1a Fix most of rgba tests 2016-02-22 22:40:17 -05:00
Joshua Holmer
30f03678d2 Fix filtering, passes some more tests 2016-02-21 23:27:19 -05:00
Joshua Holmer
675a28ee32 Correctly save best run
Fixes #10
2016-02-20 14:49:33 -05:00
Joshua Holmer
9d48ae911e A few inconsequential changes 2016-02-20 02:58:51 -05:00
Joshua Holmer
6c355b0c83 OH MY GOSH A TEST PASSED 2016-02-19 15:24:43 -05:00
Joshua Holmer
677ce14b96 Improve palette downgrading 2016-02-19 14:48:52 -05:00
Joshua Holmer
5c0bbbe2bb Fix many issues 2016-02-18 16:23:16 -05:00
Joshua Holmer
60cf7c96e7 Fix some clippy lints 2016-02-16 09:56:30 -05:00
Joshua Holmer
08e6d42021 Implement multithreading for deflate passes
Closes #6
2016-02-04 10:32:20 -05:00
Joshua Holmer
4894c4a072 Make our tests fail again
Although now they test that the conversion was lossless,
which is extremely important for this program to be useful
2016-01-18 20:03:39 -05:00
Joshua Holmer
e4c9aca4a5 Fix outputting IHDR twice 2016-01-16 14:30:05 -05:00
Joshua Holmer
0866eb01ea Only change interlacing if we have to 2016-01-15 13:35:41 -05:00
Joshua Holmer
c9ea565d1d Formatting 2016-01-14 15:22:21 -05:00
Joshua Holmer
ab15fc1d61 Color reduction 2016-01-14 13:24:56 -05:00
Joshua Holmer
0acd44e1b2 More color reduction 2016-01-13 10:22:04 -05:00
Joshua Holmer
c63c40b303 Correctly write transparency palette back out 2016-01-12 13:23:52 -05:00
Joshua Holmer
534ba84052 Add quite a few things, including parsing transparency headers 2016-01-12 13:16:57 -05:00
Joshua Holmer
9267f040af Implement bit depth reduction 2016-01-12 11:50:39 -05:00
Joshua Holmer
939d886932 Add header stripping 2016-01-12 11:06:52 -05:00
Joshua Holmer
fe95e9460e Fix output crcs 2016-01-11 21:22:08 -05:00
Joshua Holmer
ee31774078 Add basic integration tests
Also add force option--necessary for testing but may be useful to some people
who like to live dangerously
2016-01-11 14:16:05 -05:00
Joshua Holmer
12b472e572 Rename project 2016-01-11 11:03:52 -05:00
Joshua Holmer
acc0b6c5ac Cargo fmt and clippy 2016-01-11 01:06:12 -05:00
Joshua Holmer
11e475ba15 Implement heuristic filter mode and optimize modes 1-4 2016-01-11 01:01:53 -05:00
Joshua Holmer
4765c2133a Filtering, mostly 2016-01-10 23:24:02 -05:00
Joshua Holmer
e24fa4ae27 Run clippy and rustfmt 2016-01-10 15:13:12 -05:00
Joshua Holmer
471d5179d5 Write output files 2016-01-10 15:09:05 -05:00
Joshua Holmer
913d9e0c46 Minor typing optimizations 2016-01-08 16:20:04 -05:00
Joshua Holmer
5f866d9844 Completely parse CLI options 2016-01-08 15:09:00 -05:00
Joshua Holmer
273880ea0b Implement option parsing - Part 1
The compression options help text keeps getting split up by rustfmt.
Don't let it.
2016-01-07 16:29:02 -05:00
Joshua Holmer
052b047222 Get zlib compression to work 2016-01-01 01:00:57 -05:00
Joshua Holmer
9e1cf7881d Use our own libpng 2015-12-18 22:19:05 -05:00
Joshua Holmer
7d3a601686 So as to not lose my work 2015-12-16 08:01:05 -05:00