You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/encode.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -202,3 +202,25 @@ On success the buffer must be freed by the user.
202
202
\* Option may be optimized if not set explicitly.
203
203
204
204
Options not listed here have no effect on encoders.
205
+
206
+
# Performance
207
+
208
+
The default encoder settings match the [reference implementation](http://libpng.org/pub/png/libpng.html)
209
+
and will produce files of the exact same size, but there are settings that offer
210
+
better performance for a small increase in file size. Reducing compression level (set `SPNG_IMG_COMPRESSION_LEVEL` to a value lower than `6`) will reduce encoding time for all image types.
211
+
212
+
* Truecolor and truecolor-alpha images - Reduce compression level (between `1` and `5`) and leave everything else on defaults,
213
+
file size should not increase by more than 10% but encode up to three times faster.
214
+
215
+
* Indexed-color - Choose a reduced compression level (`1`-`5`), file size should stay within 5% but encode up to two times faster.
216
+
217
+
* Grayscale - Choose a reduced compression level (`1`-`5`), file size should stay within 5% but encode up two times faster.
218
+
219
+
* Grayscale-alpha images - Choose a reduced compression level (`1`-`5`), file size should stay within 5% but encode up to four times faster.
220
+
221
+
* Disabling filtering may further improve performance but will significantly increase file size.
222
+
223
+
!!! note
224
+
See [encode experiments](https://github.com/libspng/spngt/blob/master/results/README.md#encode-experiments) for more details.
225
+
226
+
Recommendations are based on benchmarks with zlib, performance with other implementations (miniz, zlib-ng) was not measured.
0 commit comments