Commit Graph

7 Commits (f2aa2836ed910ca3510585a47a8a064b5140e148)

Author SHA1 Message Date
Ben Morss f2aa2836ed
AVIF support (#671)
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.
2021-03-03 21:35:56 -05:00
Martin Reboredo 39c4644fa0
HEIF support through libheif (#670)
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.
2021-03-02 12:32:03 -05:00
Mike Frysinger f538eedc7c gd_filename: constify & localize more
Mark the data structures & functions as const & static when possible,
and punt the unused FType enum.
2021-02-05 00:45:55 -05:00
Mike Frysinger fd06f7f83c clean up trailing whitespace/newlines
This is preparation for adding some linting checks for new commits from
people.  Shouldn't be any functional changes here (tests still pass!).
2018-06-21 22:47:42 -04:00
Wangkun 917fa11bfb fix CMake error when ENABLE_WEBP 2015-05-07 17:48:37 +08:00
Chris Reuter 0cb34fdb31 Got gd_filename.c to work correctly under Windows.
Specified calling convention on function pointers.  (This matters
under Windows).

Switched from rindex() to strrchr() (oops!).

Tidied the formatting a bit.
2014-02-07 14:17:17 -05:00
Chris Reuter c9d2f89597 Added gdImageFile(), gdImageCreateFromFile() and gdSupportsFileType().
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.
2013-12-16 17:27:34 -05:00