File: INSTALL

package info (click to toggle)
pngquant 2.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 316 kB
  • sloc: ansic: 1,472; sh: 532; makefile: 84
file content (103 lines) | stat: -rw-r--r-- 3,186 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
## Compiling on Linux, *BSD and macOS using GNU/Make

(For instructions for Windows or Rust, see sections below.)

To get the code:

    git clone --recursive https://github.com/kornelski/pngquant.git

You will need libpng installed with development headers.
On Linux install `libpng-dev` package. On macOS `brew install libpng`.

There's an optional `./configure` step (see sections below). Run:

    make

It will create `pngquant` executable in the current directory. If you'd like
to install it system-wide:

    sudo make install

By default it will be installed in `/usr/local/bin`. To install it in another
directory run `./configure --prefix=dir && make`.

pngquant uses GNU Makefile. To compile on FreeBSD you will need to use `gmake`.

Avoid Linux distros that ship with libpng 1.2. It is old and buggy.
libpng 1.6 or later is required.

### Custom static libpng

Extract libpng source code as a *sub*directory of pngquant source directory.
Build static libpng (`./configure --enable-static && make`), and then
`./configure && make` pngquant.

## Compiling via Rust/Cargo (all platforms, including Windows)

### Prerequisites

Install Rust 1.36 or later: https://www.rust-lang.org/install.html

On Windows also install msys-git and Visual C++ Build Tools
with Windows 8 SDK enabled, and reboot.

### Building

Get the code:

    # Unix version
    git clone --recursive https://github.com/kornelski/pngquant.git

    # Windows version
    git clone -b msvc --recursive https://github.com/kornelski/pngquant.git

And then build:

    cd pngquant
    cargo build --release

This will create executable in `target/release/pngquant`(`.exe`).

You can build with additional features:

    cargo build --release --features=sse,lcms2

The features are:

 * `sse` — enable use of SSE on x86 CPUs.
 * `lcms2` — compile with support for color profiles via Little CMS.
 * `lcms2-static` — same, but link statically.
 * `cocoa` — compile with support for color profiles via macOS Cocoa.
 * `openmp` — use OpenMP to accelerate conversion. Requires GCC 9 or later.
    Warning: GCC 4 will produce buggy code!
 * `openmp-static` — same, but link statically.

## Compilation with OpenMP

    cargo build --release --features=openmp # or
    cargo build --release --features=openmp-static

On macOS you may need to install gcc (`brew install gcc`) and run `export CC=gcc-10` first.

## Compilation with Cocoa image reader

macOS version can use Cocoa to read images. This adds support for color profiles
and other image formats as input. However, it also disables support for preserving PNG metadata.

    cargo build --release --features=cocoa

## Compilation with Little CMS 2

Little CMS library is used by default.

It's linked dynamically if `pkg-config` is working (e.g. install `liblcms2-dev`).
Otherwise uses static build as a fallback.

Set `export LCMS2_STATIC=1` or build `--features=lcms2-static` to force static linking.

## Compilation of `libimagequant.a` only

If you want to use pngquant's conversion algorithm without loading/saving PNG
files, then you can run `make` or `cargo build --release` in the `lib/` directory.

The library doesn't need libpng nor zlib.