Rename project

This commit is contained in:
Joshua Holmer 2016-01-11 11:03:52 -05:00
parent acc0b6c5ac
commit 12b472e572
4 changed files with 41 additions and 44 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "optipng" name = "oxipng"
version = "2.0.0-alpha.1" version = "1.0.0-alpha.1"
authors = ["Joshua Holmer <jholmer.in@gmail.com>"] authors = ["Joshua Holmer <jholmer.in@gmail.com>"]
[dependencies] [dependencies]

View file

@ -1,62 +1,60 @@
# OptiPNG-Next # OxiPng
## Overview ## Overview
OptiPNG-Next version 2 is a completely rewrite of the OptiPNG project, OxiPng began as a completely rewrite of the OxiPng project,
which is assumed to be dead as no commit has been made to it since 2013. which is assumed to be dead as no commit has been made to it since 2013.
The name has been changed to avoid confusion and potential legal issues.
OptiPNG is a PNG compression optimizer. OxiPng is a PNG compression optimizer.
In the typical use case, OptiPNG recompresses PNG image files In the typical use case, OxiPng recompresses PNG image files
losslessly, converts external formats (BMP, GIF, PNM and TIFF) to losslessly, converts external formats (BMP, GIF, PNM and TIFF) to
optimized PNG, and performs PNG integrity checks and corrections. optimized PNG, and performs PNG integrity checks and corrections.
At the user's explicit request, OptiPNG is also capable to alter
image data or remove metadata.
## Building ## Building
Building OptiPNG-Next can be done using Rust 1.5.0 or greater with Cargo installed, as follows: Building OxiPng can be done using the latest stable or nightly Rust with Cargo installed, as follows:
``` ```
git clone https://github.com/shssoichiro/optipng-next.git git clone https://github.com/shssoichiro/oxipng.git
cd optipng-next cd oxipng
cargo build --release cargo build --release
cp target/release/optipng /usr/local/bin cp target/release/oxipng /usr/local/bin
``` ```
Please note that zlib is a required build dependency. OptiPNG should work with any 1.x version of zlib, Please note that zlib is a required build dependency. OxiPng should work with any 1.x version of zlib,
but you are advised to use the latest version (currently 1.2.8) for security and bug fixes. but you are advised to use the latest version (currently 1.2.8) for security and bug fixes.
## Usage ## Usage
OptiPNG-Next is a command-line utility. Basic usage looks similar to the following: OxiPng is a command-line utility. Basic usage looks similar to the following:
``` ```
optipng -o4 -i 1 -strip all *.png oxipng -o 4 -i 1 --strip *.png
``` ```
The most commonly used options are as follows: The most commonly used options are as follows:
* Optimization: `-o1` through `-o6`, lower is faster, higher is better compression. * Optimization: `-o 1` through `-o 6`, lower is faster, higher is better compression.
The default (`-o2`) is sufficiently fast on a modern CPU and provides 30-50% compression The default (`-o 2`) is sufficiently fast on a modern CPU and provides 30-50% compression
gains over an unoptimized PNG. `-o4` is 6 times slower than `-o2` but can provide 5-10% gains over an unoptimized PNG. `-o 4` is 6 times slower than `-o 2` but can provide 5-10%
extra compression over `-o2`. Using any setting higher than `-o4` is generally unlikely extra compression over `-o 2`. Using any setting higher than `-o 4` is generally unlikely
to give any extra compression gains and is not recommended. to give any extra compression gains and is not recommended.
* Interlacing: `-i 1` will enable [Adam7](https://en.wikipedia.org/wiki/Adam7_algorithm) * Interlacing: `-i 1` will enable [Adam7](https://en.wikipedia.org/wiki/Adam7_algorithm)
PNG interlacing on any images that are processed. `-i 0` will remove interlacing from all PNG interlacing on any images that are processed. `-i 0` will remove interlacing from all
processed images. Not specifying either will keep the same interlacing state as the processed images. Not specifying either will keep the same interlacing state as the
input image. Note: Interlacing can add 25-50% to the size of an optimized image. Only use input image. Note: Interlacing can add 25-50% to the size of an optimized image. Only use
it if you have a good reason. it if you have a good reason.
* Strip: Used to remove metadata info from processed images. Generally used as `-strip all`. * Strip: Used to remove metadata info from processed images. Used via `--strip` or `-s`.
Can save a few kilobytes if you don't need the metadata. Can save a few kilobytes if you don't need the metadata.
More advanced options can be found in the man page or by running `optipng -h`. More advanced options can be found by running `oxipng -h`.
## Changes ## Changes
OptiPNG Next version 2 attempts to maintain functionality of the original OptiPNG as much as possible, OxiPng attempts to maintain functionality of the original OxiPng as much as possible,
although command line usage may have changed (OptiPNG Next follows semantic versioning). although command line usage may have changed (OxiPng follows semantic versioning).
As version 2 is in alpha, there are still some features that are missing. All features As OxiPng is in alpha, there are still some features that are missing. All intended features
that were available in the original will be implemented in OptiPNG version 2 before it moves into will be implemented in OxiPng before it moves into beta.
beta.
## Contributing ## Contributing
@ -68,5 +66,4 @@ are also welcome via GitHub.
## License ## License
OptiPNG Next is open-source software, distributed under the MIT license. (Version 2 is a complete rewrite and shares no OxiPng is open-source software, distributed under the MIT license.
code with the original OptiPNG, which is under the zlib license.)

View file

@ -1,7 +1,7 @@
// Raw un-exported bindings to libz for encoding/decoding // Raw un-exported bindings to libz for encoding/decoding
// Copyright (c) 2014 Alex Crichton, MIT & Apache licenses // Copyright (c) 2014 Alex Crichton, MIT & Apache licenses
// Originally from flate2 crate for miniz // Originally from flate2 crate for miniz
// Modified for use in Optipng // Modified for use in oxipng
use std::marker; use std::marker;
use std::mem; use std::mem;

View file

@ -1,4 +1,4 @@
extern crate optipng; extern crate oxipng;
extern crate clap; extern crate clap;
extern crate regex; extern crate regex;
@ -20,7 +20,7 @@ fn main() {
strategies.insert(i); strategies.insert(i);
} }
let default_opts = optipng::Options { let default_opts = oxipng::Options {
backup: false, backup: false,
out_file: PathBuf::new(), out_file: PathBuf::new(),
out_dir: None, out_dir: None,
@ -45,8 +45,8 @@ fn main() {
strip: false, strip: false,
}; };
let matches = App::new("optipng") let matches = App::new("oxipng")
.version("2.0.0-alpha.1") .version("1.0.0-alpha.1")
.author("Joshua Holmer <jholmer.in@gmail.com>") .author("Joshua Holmer <jholmer.in@gmail.com>")
.about("Losslessly improves compression of PNG files") .about("Losslessly improves compression of PNG files")
.arg(Arg::with_name("files") .arg(Arg::with_name("files")
@ -194,14 +194,14 @@ fn main() {
.help("Strip all metadata objects") .help("Strip all metadata objects")
.long("strip")) .long("strip"))
.after_help("Optimization levels: .after_help("Optimization levels:
-o0 => -zc3 -nz (0 or 1 trials) -o 0 => --zc 3 --nz (0 or 1 trials)
-o1 => -zc9 (1 trial) -o 1 => --zc 9 (1 trial)
-o2 => -zc9 -zs0-3 -f0,5 (8 trials) -o 2 => --zc 9 --zs 0-3 --f 0,5 (8 trials)
-o3 => -zc9 -zm8-9 -zs0-3 -f0,5 (16 trials) -o 3 => --zc 9 --zm 8-9 --zs 0-3 --f 0,5 (16 trials)
-o4 => -zc9 -zm8-9 -zs0-3 -f0-5 (48 trials) -o 4 => --zc 9 --zm 8-9 --zs 0-3 --f 0-5 (48 trials)
-o5 => -zc3-9 -zm8-9 -zs0-3 -f0-5 (192 trials) -o 5 => --zc 3-9 --zm 8-9 --zs 0-3 --f 0-5 (192 trials)
-o6 => -zc1-9 -zm7-9 -zs0-3 -f0-5 (360 trials) -o 6 => --zc 1-9 --zm 7-9 --zs 0-3 --f 0-5 (360 trials)
-o6 -zm1-9 => -zc1-9 -zm1-9 -zs0-3 -f0-5 (1080 trials) -o 6 --zm 1-9 => --zc 1-9 --zm 1-9 --zs 0-3 --f 0-5 (1080 trials)
Exhaustive combinations such as \"-o6 -zm1-9\" are not generally recommended. Exhaustive combinations such as \"-o6 -zm1-9\" are not generally recommended.
These are very slow and generally provide no compression gain. These are very slow and generally provide no compression gain.
@ -228,7 +228,7 @@ fn main() {
&mut opts); &mut opts);
} }
fn handle_optimization(inputs: Vec<PathBuf>, opts: &mut optipng::Options) { fn handle_optimization(inputs: Vec<PathBuf>, opts: &mut oxipng::Options) {
for input in inputs { for input in inputs {
if input.is_dir() { if input.is_dir() {
if opts.recursive { if opts.recursive {
@ -244,14 +244,14 @@ fn handle_optimization(inputs: Vec<PathBuf>, opts: &mut optipng::Options) {
} else { } else {
opts.out_file = input.clone(); opts.out_file = input.clone();
} }
match optipng::optimize(&input, opts) { match oxipng::optimize(&input, opts) {
Ok(_) => (), Ok(_) => (),
Err(x) => println!("{}", x), Err(x) => println!("{}", x),
}; };
} }
} }
fn parse_opts_into_struct(matches: &ArgMatches, opts: &mut optipng::Options) -> Result<(), String> { fn parse_opts_into_struct(matches: &ArgMatches, opts: &mut oxipng::Options) -> Result<(), String> {
match matches.value_of("optimization") { match matches.value_of("optimization") {
Some("0") => { Some("0") => {
opts.idat_recoding = false; opts.idat_recoding = false;