Skip to content

Commit 9cbb4c2

Browse files
authored
Merge pull request libvips#1709 from libvips/add-libnsgif
Add libnsgif support
2 parents 9589a51 + 003a444 commit 9cbb4c2

File tree

25 files changed

+3052
-1818
lines changed

25 files changed

+3052
-1818
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ Debug build:
116116
make
117117
make install
118118

119+
# Built-in loaders
120+
121+
libvips has a number of built-in loaders and savers. You can disable these if
122+
you wish, for example:
123+
124+
./configure --prefix=/Users/john/vips --without-nsgif --without-ppm
125+
119126
# Dependencies
120127

121128
libvips has to have `libglib2.0-dev` and `libexpat1-dev`. Other dependencies
@@ -128,14 +135,14 @@ libraries automatically. See `./configure --help` for a set of flags to
128135
control library detection. Packages are generally found with `pkg-config`,
129136
so make sure that is working.
130137

131-
Libraries like giflib and nifti do not use `pkg-config` so libvips will also
138+
Libraries like nifti do not use `pkg-config` so libvips will also
132139
look for them in the default path and in `$prefix`. If you have installed
133140
your own versions of these libraries in a different location, libvips will
134141
not see them. Use switches to libvips configure like:
135142

136143
./configure --prefix=/Users/john/vips \
137-
--with-giflib-includes=/opt/local/include \
138-
--with-giflib-libraries=/opt/local/lib
144+
--with-nifti-includes=/opt/local/include \
145+
--with-nifti-libraries=/opt/local/lib
139146

140147
or perhaps:
141148

@@ -151,11 +158,6 @@ The IJG JPEG library. Use the `-turbo` version if you can.
151158

152159
If available, libvips adds support for EXIF metadata in JPEG files.
153160

154-
### giflib
155-
156-
The standard gif loader. If this is not present, vips will try to load gifs
157-
via imagemagick instead.
158-
159161
### librsvg
160162

161163
The usual SVG loader. If this is not present, vips will try to load SVGs

configure.ac

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,16 @@ VIPS_LIBS="$VIPS_LIBS $MATIO_LIBS"
979979
# not external libraries, but have options to disable them, helps to
980980
# reduce attack surface
981981

982+
AC_ARG_WITH([nsgif],
983+
AS_HELP_STRING([--without-nsgif], [build without nsgif load (default: with)]))
984+
985+
if test x"$with_nsgif" != x"no"; then
986+
AC_DEFINE(HAVE_NSGIF,1,[define to build nsgif load support.])
987+
with_nsgif=yes
988+
fi
989+
990+
AM_CONDITIONAL(ENABLE_NSGIF, [test x"$with_nsgif" = x"yes"])
991+
982992
AC_ARG_WITH([ppm],
983993
AS_HELP_STRING([--without-ppm], [build without ppm (default: with)]))
984994

@@ -1102,19 +1112,6 @@ VIPS_CFLAGS="$VIPS_CFLAGS $TIFF_CFLAGS"
11021112
VIPS_INCLUDES="$VIPS_INCLUDES $TIFF_INCLUDES"
11031113
VIPS_LIBS="$VIPS_LIBS $TIFF_LIBS"
11041114

1105-
# giflib
1106-
FIND_GIFLIB(
1107-
[with_giflib="yes (found by search)"
1108-
],
1109-
[AC_MSG_WARN([giflib not found; disabling direct GIF support])
1110-
with_giflib=no
1111-
]
1112-
)
1113-
1114-
VIPS_CFLAGS="$VIPS_CFLAGS $GIFLIB_CFLAGS"
1115-
VIPS_INCLUDES="$VIPS_INCLUDES $GIFLIB_INCLUDES"
1116-
VIPS_LIBS="$VIPS_LIBS $GIFLIB_LIBS"
1117-
11181115
# Look for libspng first
11191116
# 0.6.1 uses "libspng.pc", git master libspng uses "spng.pc"
11201117
AC_ARG_WITH([libspng],
@@ -1292,6 +1289,7 @@ gobject introspection: $found_introspection, \
12921289
RAD load/save: $with_radiance, \
12931290
Analyze7 load/save: $with_analyze, \
12941291
PPM load/save: $with_ppm, \
1292+
GIF load: $with_nsgif, \
12951293
generate C++ docs: $with_doxygen, \
12961294
use fftw3 for FFT: $with_fftw, \
12971295
accelerate loops with orc: $with_orc, \
@@ -1305,7 +1303,6 @@ PNG load/save with libpng: $with_png, \
13051303
8bpp PNG quantisation: $with_imagequant, \
13061304
TIFF load/save with libtiff: $with_tiff, \
13071305
image pyramid save: $with_gsf, \
1308-
GIF load with giflib: $with_giflib, \
13091306
HEIC/AVIF load/save with libheif: $with_heif, \
13101307
WebP load/save with libwebp: $with_libwebp, \
13111308
PDF load with PDFium: $with_pdfium, \
@@ -1350,6 +1347,7 @@ AC_CONFIG_FILES([
13501347
libvips/convolution/Makefile
13511348
libvips/deprecated/Makefile
13521349
libvips/foreign/Makefile
1350+
libvips/foreign/libnsgif/Makefile
13531351
libvips/freqfilt/Makefile
13541352
libvips/histogram/Makefile
13551353
libvips/draw/Makefile
@@ -1390,6 +1388,7 @@ gobject introspection: $found_introspection
13901388
RAD load/save: $with_radiance
13911389
Analyze7 load/save: $with_analyze
13921390
PPM load/save: $with_ppm
1391+
GIF load: $with_nsgif
13931392
generate C++ docs: $with_doxygen
13941393
13951394
## Optional dependencies
@@ -1412,7 +1411,6 @@ PNG load/save with libpng: $with_png
14121411
TIFF load/save with libtiff: $with_tiff
14131412
image pyramid save: $with_gsf
14141413
(requires libgsf-1 1.14.26 or later)
1415-
GIF load with giflib: $with_giflib
14161414
HEIC/AVIF load/save with libheif: $with_heif
14171415
WebP load/save with libwebp: $with_libwebp
14181416
(requires libwebp, libwebpmux, libwebpdemux 0.6.0 or later)

cplusplus/include/vips/Makefile.am

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ pkginclude_HEADERS = \
55
VConnection8.h \
66
vips8
77

8-
vips-operators.h:
9-
echo "// headers for vips operations" > vips-operators.h; \
10-
echo -n "// " >> vips-operators.h; \
11-
date >> vips-operators.h; \
12-
echo "// this file is generated automatically, do not edit!" >> vips-operators.h; \
13-
./../../gen-operators.py -g h >> vips-operators.h
8+
vips-operators:
9+
echo "// headers for vips operations" > vips-operators; \
10+
echo "// paste this file into VImage8.h, do not leave in repo" > vips-operators; \
11+
echo -n "// " >> vips-operators; \
12+
date >> vips-operators; \
13+
echo "// this file is generated automatically, do not edit!" >> vips-operators; \
14+
./../../gen-operators.py -g h >> vips-operators

libvips/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ else
99
OPTIONAL_DIST_DIR += deprecated
1010
endif
1111

12+
if ENABLE_NSGIF
13+
OPTIONAL_LIB += foreign/libnsgif/libnsgif.la
14+
endif
15+
1216
SUBDIRS = \
1317
include \
1418
foreign \

libvips/colour/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
noinst_LTLIBRARIES = libcolour.la
2-
31
SUBDIRS = profiles
42

3+
noinst_LTLIBRARIES = libcolour.la
4+
55
libcolour_la_SOURCES = \
66
profiles.c \
77
profiles.h \

libvips/foreign/Makefile.am

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if ENABLE_NSGIF
2+
SUBDIRS = libnsgif
3+
endif
4+
15
noinst_LTLIBRARIES = libforeign.la
26

37
libforeign_la_SOURCES = \
@@ -8,7 +12,7 @@ libforeign_la_SOURCES = \
812
niftisave.c \
913
quantise.c \
1014
exif.c \
11-
gifload.c \
15+
nsgifload.c \
1216
cairo.c \
1317
pdfload.c \
1418
pdfiumload.c \
@@ -66,7 +70,7 @@ libforeign_la_SOURCES = \
6670
jpegload.c \
6771
jpegsave.c
6872

69-
EXTRA_DIST =
73+
EXTRA_DIST = libnsgif
7074

7175
AM_CPPFLAGS = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@
7276

libvips/foreign/foreign.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,22 +2187,25 @@ vips_foreign_operation_init( void )
21872187
extern GType vips_foreign_load_nifti_source_get_type( void );
21882188
extern GType vips_foreign_save_nifti_get_type( void );
21892189

2190-
extern GType vips_foreign_load_gif_file_get_type( void );
2191-
extern GType vips_foreign_load_gif_buffer_get_type( void );
2192-
extern GType vips_foreign_load_gif_source_get_type( void );
2190+
extern GType vips_foreign_load_nsgif_file_get_type( void );
2191+
extern GType vips_foreign_load_nsgif_buffer_get_type( void );
2192+
extern GType vips_foreign_load_nsgif_source_get_type( void );
21932193

21942194
vips_foreign_load_csv_file_get_type();
21952195
vips_foreign_load_csv_source_get_type();
21962196
vips_foreign_save_csv_file_get_type();
21972197
vips_foreign_save_csv_target_get_type();
2198+
21982199
vips_foreign_load_matrix_file_get_type();
21992200
vips_foreign_load_matrix_source_get_type();
22002201
vips_foreign_save_matrix_file_get_type();
22012202
vips_foreign_save_matrix_target_get_type();
22022203
vips_foreign_print_matrix_get_type();
2204+
22032205
vips_foreign_load_raw_get_type();
22042206
vips_foreign_save_raw_get_type();
22052207
vips_foreign_save_raw_fd_get_type();
2208+
22062209
vips_foreign_load_vips_file_get_type();
22072210
vips_foreign_load_vips_source_get_type();
22082211
vips_foreign_save_vips_file_get_type();
@@ -2246,11 +2249,11 @@ vips_foreign_operation_init( void )
22462249
vips_foreign_load_svg_source_get_type();
22472250
#endif /*HAVE_RSVG*/
22482251

2249-
#ifdef HAVE_GIFLIB
2250-
vips_foreign_load_gif_file_get_type();
2251-
vips_foreign_load_gif_buffer_get_type();
2252-
vips_foreign_load_gif_source_get_type();
2253-
#endif /*HAVE_GIFLIB*/
2252+
#ifdef HAVE_NSGIF
2253+
vips_foreign_load_nsgif_file_get_type();
2254+
vips_foreign_load_nsgif_buffer_get_type();
2255+
vips_foreign_load_nsgif_source_get_type();
2256+
#endif /*HAVE_NSGIF*/
22542257

22552258
#ifdef HAVE_GSF
22562259
vips_foreign_save_dz_file_get_type();

0 commit comments

Comments
 (0)