Demand for AVIF support on the web is growing, as the word gets out
about this new file format which allows higher-quality encoding at
smaller sizes. Core contributors to major open-source CMSs are
interested in auto-generating AVIF images! They've been simply
waiting for support to appear in libgd.
This PR aims to meet the growing demand, and to help bring smaller,
more beautiful images to more of the web - to sites created by
experienced developers and CMS users alike.
This PR adds support by incorporating libavif in addition to the
existing libheif support. It's generally felt that libavif has
more complete support for the AVIF format. libavif is also used
by the Chromium project and squoosh.app.
In this PR, I've endeavored to incorporate the latest research into
best practices for AVIF encoding - not just for default quantizer
values, but also an algorithm for determining the number of
horizontal tiles, vertical tiles, and threads.
Fixes#557.
With the adoption of AVIF by Firefox and Chromium based browsers (still
in experimental phase), the newer incorporation of HEIF by Canon and Sony
in their cameras and the newer support of both of them in modern software
like ImageMagick, GIMP and Krita, `gd` haven't seen any endorsement for
the formats up until this PR.
Reading and writing is done by `libheif`, with functionality for chroma
subsampling (for now `4:2:0`, `4:2:2` and `4:4:4`), quality (with new
`200` for lossless) and compression (whether `HEVC` or `AV1`) selection.
This was tested with `libheif` version `1.11.0` in my Solus machine.
Also, fixes both #395 and #557.
My previous changes to fix up shellcheck warnings broke this slightly
by not actually displaying the program name. Add some debugging info
to help triage issues in here in the future.
In the docs there is a minor mention of the unused HAVE_STDARG_H symbol
which is not used in libgd anymore. The <stdarg.h> header is part of C89
standard headers anyway and can be included unconditionally.
The following API functions now accept the font names and the text to be
printed as `const char*` rater than `char*`. This makes the functions
much more `C++` friendly.
gdImageStringFT();
gdImageStringTTF();
gdImageStringFTEx();
Other functions/types affected:
typeed struct fontkey_t;
any2eucjp();
gdTcl_UtfToUniChar();
DetectKanjiCode();
do_convert();
do_check_and_conv();
Basically, docs/naturaldocs/license.txt is a duplicate of COPYING, which
is going to be used only by Natural Docs. We remove the file and generate
it on the fly instead; also we adjust COPYING to make it easier to obtain
a pleasing result without sacrificing COPYING's readability.
The diff is best viewed with whitespace changes ignored.
This changeset imports documention for gdImage to gdImagePng*() into
Natural Docs. Documention is based on the text of the original
manual, version 2.0.36 but adapted to better suit the format.
Subsequent changesets will introduce docs for subsequent manual
entries.
naturaldocs, when present, is invoked by bootstrap.sh. The completed
manual will be in docs/naturaldocs/html/index.html. It can also be
explicitly invoked by running docs/naturaldocs/run_docs.sh.
This change also removed docs/naturaldocs/project/Menu.txt, since it
currently contains no non-generated content and is prone to introduce
noise into the changeset.
These are convenience functions which load or save image data to a
file. They are roughly equivalent to opening a file handle with
fopen() and calling gdImageCreateFrom*() or gdImage*() on the FILE
pointer. However, these functions identify the input or output format
from the filename suffix and call the appropriate read or write
function accordingly.
gdSupportsFileType() can be used to test if a specific file format
is supported.
Most scripting interfaces already do something like this but now
there's support for doing it from C as well.
This change also adds test cases for the code and naturaldocs
documentation.
gdImageCopyGaussianBlurred() returns a blurred copy of its argument.
Blurring is done in two passes to take advantage of the Gaussian
function's separability for. This makes the algorithm much faster
than single-pass implementations, especially for larger radii.
This change also adds documentation for the new function and the
existing blur (gdImageGaussianBlur()).
This changeset adds scripts and frontmatter for a user manual
for LibGD. The manual is written using naturaldoc. That is, the
actual manual (minus some front-matter taken from the manual for
version 2.0.36) is generated from specially-formatted comments in
the source code.
bootstrap.sh has been modified to also trigger generation of the
manual.