Merge branch 'master' into no-blank-tiles
This commit is contained in:
commit
72b67d0ec2
@ -1,6 +1,5 @@
|
||||
language: cpp
|
||||
before_install:
|
||||
- sudo add-apt-repository ppa:lyrasis/precise-backports -y
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install automake gtk-doc-tools
|
||||
- sudo apt-get install gobject-introspection
|
||||
@ -8,7 +7,7 @@ before_install:
|
||||
- sudo apt-get install libpng12-dev libwebp-dev libtiff4-dev libxml2-dev
|
||||
- sudo apt-get install swig libmagick++-dev bc
|
||||
- sudo apt-get install libcfitsio3-dev libgsl0-dev libmatio-dev
|
||||
- sudo apt-get install liborc-0.4-dev liblcms2-dev
|
||||
- sudo apt-get install liborc-0.4-dev liblcms2-dev libpoppler-glib-dev
|
||||
before_script:
|
||||
- ./bootstrap.sh
|
||||
- ./configure
|
||||
|
@ -1,8 +1,15 @@
|
||||
1/5/16 started 8.4
|
||||
- many more wepsave options [Felix Bünemann]
|
||||
- added quant_table option to wepsave [Felix Bünemann]
|
||||
|
||||
15/4/16 started 8.3.1
|
||||
- rename vips wrapper script, it was still vips-8.2, thanks Benjamin
|
||||
- export C++ operator overloads for MSVC linking [Lovell]
|
||||
- fix magickload @page with GraphicsMagick
|
||||
- add giflib5 support
|
||||
- allow resize >1 on one axis, <1 on the other
|
||||
- vips_resize has an optional @kernel argument
|
||||
- fix giflib4 detection [felixbuenemann]
|
||||
|
||||
29/1/16 started 8.3
|
||||
- add vips_reduce*() ... a fast path for affine downsize
|
||||
|
15
README.md
15
README.md
@ -150,12 +150,14 @@ libraries automatically. See `./configure --help` for a set of flags to
|
||||
control library detection. Packages are generally found with `pkg-config`,
|
||||
so make sure that is working.
|
||||
|
||||
libtiff and libjpeg do not usually use `pkg-config` so libvips looks for
|
||||
libtiff, giflib and libjpeg do not usually use `pkg-config` so libvips looks for
|
||||
them in the default path and in `$prefix`. If you have installed your own
|
||||
versions of these libraries in a different location, libvips will not see
|
||||
them. Use switches to libvips configure like:
|
||||
|
||||
./configure --prefix=/Users/john/vips \
|
||||
--with-giflib-includes=/opt/local/include \
|
||||
--with-giflib-libraries=/opt/local/lib \
|
||||
--with-tiff-includes=/opt/local/include \
|
||||
--with-tiff-libraries=/opt/local/lib \
|
||||
--with-jpeg-includes=/opt/local/include \
|
||||
@ -187,8 +189,6 @@ If available, libvips adds support for EXIF metadata in JPEG files.
|
||||
The standard gif loader. If this is not present, vips will try to load gifs
|
||||
via imagemagick instead.
|
||||
|
||||
vips will only work with giflib 4.
|
||||
|
||||
### librsvg
|
||||
|
||||
The usual SVG loader. If this is not present, vips will try to load SVGs
|
||||
@ -234,6 +234,15 @@ If available, libvips adds support for loading all libMagick-supported
|
||||
image file types. Use `--with-magickpackage=GraphicsMagick` to build against
|
||||
graphicsmagick instead.
|
||||
|
||||
Imagemagick 6.9+ needs to have been built with `--with-modules`. Most packaged
|
||||
IMs are, I think, but if you are rolling your own, you'll need to pass
|
||||
this flag to configure.
|
||||
|
||||
If you are going to be using libvips with untrusted images, perhaps in a
|
||||
web-server, for example, you should consider the security implications of
|
||||
using a package with such a large attack surface. You might prefer not to
|
||||
enable Magick support.
|
||||
|
||||
### pangoft2
|
||||
|
||||
If available, libvips adds support for text rendering. You need the
|
||||
|
16
TODO
16
TODO
@ -1,3 +1,19 @@
|
||||
- this seems to not work:
|
||||
|
||||
$ vips copy k2.jpg x.dz[suffix=.jpg[Q=90]]
|
||||
dzsave: not , or ) after parameter
|
||||
|
||||
- add more webp tests to py suite
|
||||
|
||||
- try moving some more of the CLI tests to py
|
||||
|
||||
- the gif tests in the suite sometimes fail with giflib5 because of an
|
||||
uninitialized struct in giflib, see
|
||||
|
||||
https://sourceforge.net/p/giflib/bugs/94/
|
||||
|
||||
sadly ubuntu 16.04 only comes with giflib5, and giflib5 is currently broken
|
||||
|
||||
- I like the new int mask creator in reducev, can we use it in im_vips2imask()
|
||||
as well?
|
||||
|
||||
|
124
acinclude.m4
124
acinclude.m4
@ -631,14 +631,14 @@ if test "$GIFLIB_LIBS" = ""; then
|
||||
INCLUDES="$GIFLIB_INCLUDES $INCLUDES"
|
||||
|
||||
# Try the standard search path first
|
||||
AC_TRY_LINK([#include <gif_lib.h>],[EGifSetGifVersion(0,0)], [
|
||||
AC_TRY_LINK([#include <gif_lib.h>],[DGifSlurp(0)], [
|
||||
GIFLIB_LIBS="-lgif"
|
||||
], [
|
||||
# giflib is not in the standard search path, try $prefix
|
||||
|
||||
LIBS="-L${prefix}/lib $LIBS"
|
||||
|
||||
AC_TRY_LINK([#include <gif_lib.h>],[EGifSetGifVersion(0,0)], [
|
||||
AC_TRY_LINK([#include <gif_lib.h>],[DGifSlurp(0)], [
|
||||
GIFLIB_LIBS="-L${prefix}/lib -lgif"
|
||||
], [
|
||||
GIFLIB_LIBS=no
|
||||
@ -684,3 +684,123 @@ fi
|
||||
|
||||
])dnl
|
||||
|
||||
|
||||
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
|
||||
dnl
|
||||
dnl FIND_LIBWEBP[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
|
||||
dnl ---------------------------------------------------
|
||||
dnl
|
||||
dnl Find webp libraries and headers ... useful for platforms which are missing
|
||||
dnl the webp .pc file
|
||||
dnl
|
||||
dnl Put compile stuff in LIBWEBP_INCLUDES
|
||||
dnl Put link stuff in LIBWEBP_LIBS
|
||||
dnl Define HAVE_LIBWEBP if found.
|
||||
dnl
|
||||
AC_DEFUN([FIND_LIBWEBP], [
|
||||
AC_REQUIRE([AC_PATH_XTRA])
|
||||
|
||||
LIBWEBP_INCLUDES=""
|
||||
LIBWEBP_LIBS=""
|
||||
|
||||
AC_ARG_WITH(libwebp,
|
||||
AS_HELP_STRING([--without-libwebp], [build without libwebp (default: test)]))
|
||||
# Treat --without-libwebp like --without-libwebp-includes --without-libwebp-libraries.
|
||||
if test "$with_libwebp" = "no"; then
|
||||
LIBWEBP_INCLUDES=no
|
||||
LIBWEBP_LIBS=no
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(libwebp-includes,
|
||||
AS_HELP_STRING([--with-libwebp-includes=DIR], [libwebp includes are in DIR]),
|
||||
LIBWEBP_INCLUDES="-I$withval")
|
||||
AC_ARG_WITH(libwebp-libraries,
|
||||
AS_HELP_STRING([--with-libwebp-libraries=DIR], [libwebp libraries are in DIR]),
|
||||
LIBWEBP_LIBS="-L$withval -lwebp")
|
||||
|
||||
AC_MSG_CHECKING(for libwebp)
|
||||
|
||||
# Look for webp/decode.h
|
||||
if test "$LIBWEBP_INCLUDES" = ""; then
|
||||
# Check the standard search path
|
||||
AC_TRY_COMPILE([#include <webp/decode.h>],[int a;],[
|
||||
LIBWEBP_INCLUDES=""
|
||||
], [
|
||||
# webp/decode.h is not in the standard search path, try
|
||||
# $prefix
|
||||
libwebp_save_INCLUDES="$INCLUDES"
|
||||
|
||||
INCLUDES="-I${prefix}/include $INCLUDES"
|
||||
|
||||
AC_TRY_COMPILE([#include <webp/decode.h>],[int a;],[
|
||||
LIBWEBP_INCLUDES="-I${prefix}/include"
|
||||
], [
|
||||
LIBWEBP_INCLUDES="no"
|
||||
])
|
||||
|
||||
INCLUDES=$libwebp_save_INCLUDES
|
||||
])
|
||||
fi
|
||||
|
||||
# Now for the libraries
|
||||
if test "$LIBWEBP_LIBS" = ""; then
|
||||
libwebp_save_LIBS="$LIBS"
|
||||
libwebp_save_INCLUDES="$INCLUDES"
|
||||
|
||||
LIBS="-lwebp $LIBS"
|
||||
INCLUDES="$LIBWEBP_INCLUDES $INCLUDES"
|
||||
|
||||
# Try the standard search path first
|
||||
AC_TRY_LINK([#include <webp/decode.h>],[WebPInitDecoderConfig(0)], [
|
||||
LIBWEBP_LIBS="-lwebp"
|
||||
], [
|
||||
# libwebp is not in the standard search path, try $prefix
|
||||
|
||||
LIBS="-L${prefix}/lib $LIBS"
|
||||
|
||||
AC_TRY_LINK([#include <webp/decode.h>],[WebPInitDecoderConfig(0)], [
|
||||
LIBWEBP_LIBS="-L${prefix}/lib -lwebp"
|
||||
], [
|
||||
LIBWEBP_LIBS=no
|
||||
])
|
||||
])
|
||||
|
||||
LIBS="$libwebp_save_LIBS"
|
||||
INCLUDES="$libwebp_save_INCLUDES"
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBWEBP_LIBS)
|
||||
AC_SUBST(LIBWEBP_INCLUDES)
|
||||
|
||||
# Print a helpful message
|
||||
libwebp_libraries_result="$LIBWEBP_LIBS"
|
||||
libwebp_includes_result="$LIBWEBP_INCLUDES"
|
||||
|
||||
if test x"$libwebp_libraries_result" = x""; then
|
||||
libwebp_libraries_result="in default path"
|
||||
fi
|
||||
if test x"$libwebp_includes_result" = x""; then
|
||||
libwebp_includes_result="in default path"
|
||||
fi
|
||||
|
||||
if test "$libwebp_libraries_result" = "no"; then
|
||||
libwebp_libraries_result="(none)"
|
||||
fi
|
||||
if test "$libwebp_includes_result" = "no"; then
|
||||
libwebp_includes_result="(none)"
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([libraries $libwebp_libraries_result, headers $libwebp_includes_result])
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test "$LIBWEBP_INCLUDES" != "no" && test "$LIBWEBP_LIBS" != "no"; then
|
||||
AC_DEFINE(HAVE_LIBWEBP,1,[Define if you have libwebp libraries and header files.])
|
||||
$1
|
||||
else
|
||||
LIBWEBP_INCLUDES=""
|
||||
LIBWEBP_LIBS=""
|
||||
$2
|
||||
fi
|
||||
|
||||
])dnl
|
||||
|
||||
|
84
configure.ac
84
configure.ac
@ -2,7 +2,7 @@
|
||||
|
||||
# also update the version number in the m4 macros below
|
||||
|
||||
AC_INIT([vips], [8.3.1], [vipsip@jiscmail.ac.uk])
|
||||
AC_INIT([vips], [8.4.0], [vipsip@jiscmail.ac.uk])
|
||||
# required for gobject-introspection
|
||||
AC_PREREQ(2.62)
|
||||
|
||||
@ -17,8 +17,8 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# user-visible library versioning
|
||||
m4_define([vips_major_version], [8])
|
||||
m4_define([vips_minor_version], [3])
|
||||
m4_define([vips_micro_version], [1])
|
||||
m4_define([vips_minor_version], [4])
|
||||
m4_define([vips_micro_version], [0])
|
||||
m4_define([vips_version],
|
||||
[vips_major_version.vips_minor_version.vips_micro_version])
|
||||
|
||||
@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
|
||||
# binary interface changes not backwards compatible?: reset age to 0
|
||||
|
||||
LIBRARY_CURRENT=46
|
||||
LIBRARY_REVISION=1
|
||||
LIBRARY_REVISION=2
|
||||
LIBRARY_AGE=4
|
||||
|
||||
# patched into include/vips/version.h
|
||||
@ -439,66 +439,66 @@ fi
|
||||
if test x"$with_magick" != "xno"; then
|
||||
# we SetImageOption to disable some DICOM read processing, but that's only
|
||||
# in more recent imagemagicks and not in graphicsmagick
|
||||
save_LIBS=$LIBS
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $MAGICK_LIBS"
|
||||
AC_CHECK_FUNCS(SetImageOption,
|
||||
AC_DEFINE(HAVE_SETIMAGEOPTION,1,
|
||||
[define if your magick has SetImageOption.]))
|
||||
LIBS=$save_LIBS
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
if test x"$with_magick" != "xno"; then
|
||||
# newer ImageMagicks use MagickCoreGenesis instead of InitializeMagick argh
|
||||
save_LIBS=$LIBS
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $MAGICK_LIBS"
|
||||
AC_CHECK_FUNCS(MagickCoreGenesis,
|
||||
AC_DEFINE(HAVE_MAGICKCOREGENESIS,1,
|
||||
[define if your magick has MagickCoreGenesis.]))
|
||||
LIBS=$save_LIBS
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
if test x"$with_magick" != "xno"; then
|
||||
# newer ImageMagicks use ResetImagePropertyIterator instead of
|
||||
# ResetImageAttributeIterator argh
|
||||
save_LIBS=$LIBS
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $MAGICK_LIBS"
|
||||
AC_CHECK_FUNCS(ResetImagePropertyIterator,
|
||||
AC_DEFINE(HAVE_RESETIMAGEPROPERTYITERATOR,1,
|
||||
[define if your magick has ResetImagePropertyIterator.]))
|
||||
LIBS=$save_LIBS
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
if test x"$with_magick" != "xno"; then
|
||||
# so ... do we have ResetImageAttributeIterator()? GM does not
|
||||
save_LIBS=$LIBS
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $MAGICK_LIBS"
|
||||
AC_CHECK_FUNCS(ResetImageAttributeIterator,
|
||||
AC_DEFINE(HAVE_RESETIMAGEATTRIBUTEITERATOR,1,
|
||||
[define if your magick has ResetImageAttributeIterator.]))
|
||||
LIBS=$save_LIBS
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
if test x"$with_magick" != "xno"; then
|
||||
# more recent magicks have GetVirtualPixels rather than GetImagePixels
|
||||
save_LIBS=$LIBS
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $MAGICK_LIBS"
|
||||
AC_CHECK_FUNCS(GetVirtualPixels,
|
||||
AC_DEFINE(HAVE_GETVIRTUALPIXELS,1,
|
||||
[define if your magick has GetVirtualPixels.]))
|
||||
LIBS=$save_LIBS
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
if test x"$with_magick" != "xno"; then
|
||||
# do we have number_scenes in image_info ... imagemagick uses this, gm
|
||||
# still uses subrange
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $MAGICK_CFLAGS"
|
||||
AC_CHECK_MEMBER([struct _ImageInfo.number_scenes],
|
||||
AC_DEFINE(HAVE_NUMBER_SCENES,1,
|
||||
[define if your magick has ImageInfo.number_scenes.]),
|
||||
[],
|
||||
[#include <magick/api.h>])
|
||||
CFLAGS=$save_CFLAGS
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
|
||||
# orc
|
||||
@ -511,12 +511,12 @@ if test x"$with_orc" != "xno"; then
|
||||
[AC_DEFINE(HAVE_ORC,1,[define if you have orc-0.4.11 or later installed.])
|
||||
with_orc=yes
|
||||
PACKAGES_USED="$PACKAGES_USED orc-0.4"
|
||||
save_LIBS=$LIBS
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $ORC_LIBS"
|
||||
AC_CHECK_FUNCS(orc_program_get_error,
|
||||
AC_DEFINE(HAVE_ORC_PROGRAM_GET_ERROR,1,
|
||||
[define if your orc has orc_program_get_error.]))
|
||||
LIBS=$save_LIBS
|
||||
LIBS="$save_LIBS"
|
||||
],
|
||||
[AC_MSG_WARN([orc-0.4.11 or later not found; disabling orc support])
|
||||
with_orc=no
|
||||
@ -563,12 +563,12 @@ AC_ARG_WITH([poppler],
|
||||
AS_HELP_STRING([--without-poppler], [build without poppler (default: test)]))
|
||||
|
||||
if test x"$with_poppler" != x"no"; then
|
||||
PKG_CHECK_MODULES(POPPLER, [poppler-glib >= 0.30.0 cairo >= 1.2],
|
||||
[AC_DEFINE(HAVE_POPPLER,1,[define if you have poppler-glib >= 0.30.0 and cairo >= 1.2 installed.])
|
||||
PKG_CHECK_MODULES(POPPLER, [poppler-glib >= 0.16.0 cairo >= 1.2],
|
||||
[AC_DEFINE(HAVE_POPPLER,1,[define if you have poppler-glib >= 0.16.0 and cairo >= 1.2 installed.])
|
||||
with_poppler=yes
|
||||
PACKAGES_USED="$PACKAGES_USED poppler-glib cairo"
|
||||
],
|
||||
[AC_MSG_WARN([poppler-glib >= 0.30.0 or cairo >= 1.2 not found; disabling PDF load via poppler])
|
||||
[AC_MSG_WARN([poppler-glib >= 0.16.0 or cairo >= 1.2 not found; disabling PDF load via poppler])
|
||||
with_poppler=no
|
||||
]
|
||||
)
|
||||
@ -673,17 +673,24 @@ if test x"$with_cfitsio" != "xno"; then
|
||||
fi
|
||||
|
||||
# libwebp
|
||||
# some platforms, like ubuntu 12.04, are missing the .pc files for libwebp, so
|
||||
# we fall back to FIND_LIBWEBP
|
||||
AC_ARG_WITH([libwebp],
|
||||
AS_HELP_STRING([--without-libwebp], [build without libwebp (default: test)]))
|
||||
|
||||
if test x"$with_libwebp" != "xno"; then
|
||||
PKG_CHECK_MODULES(LIBWEBP, libwebp,
|
||||
PKG_CHECK_MODULES(LIBWEBP, libwebp >= 0.1.3,
|
||||
[AC_DEFINE(HAVE_LIBWEBP,1,[define if you have libwebp installed.])
|
||||
with_libwebp=yes
|
||||
PACKAGES_USED="$PACKAGES_USED libwebp"],
|
||||
[AC_MSG_WARN([libwebp not found; disabling libwebp support])
|
||||
with_libwebp=no
|
||||
])
|
||||
[FIND_LIBWEBP([
|
||||
with_libwebp="yes (found by search)"
|
||||
], [
|
||||
AC_MSG_WARN([libwebp not found; disabling WEBP support])
|
||||
with_libwebp=no
|
||||
])
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
# pangoft2
|
||||
@ -791,19 +798,13 @@ FIND_JPEG(
|
||||
])
|
||||
|
||||
# JPEG extension parameters available in libjpeg-turbo >=1.5.0, mozjpeg >=3.0
|
||||
if test x"$with_jpeg" = "xyes"; then
|
||||
AC_MSG_CHECKING([for JPEG extension parameters])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
#include <jpeglib.h>
|
||||
]], [[
|
||||
J_BOOLEAN_PARAM test;
|
||||
]])], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_JPEG_EXT_PARAMS],1,[libjpeg has extension parameters])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
if test x"$with_jpeg" != "xno"; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $JPEG_LIBS"
|
||||
AC_CHECK_FUNCS(jpeg_c_bool_param_supported,
|
||||
AC_DEFINE(HAVE_JPEG_EXT_PARAMS,1,
|
||||
[define if your libjpeg has extension parameters.]))
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
# libexif
|
||||
@ -824,11 +825,11 @@ fi
|
||||
# how annoying
|
||||
if test x"$with_libexif" != "xno"; then
|
||||
# cppflags not cflags because we want the preproc to see the -I as well
|
||||
save_CPPFLAGS=$CPPFLAGS
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$EXIF_CFLAGS $CPPFLAGS"
|
||||
AC_CHECK_HEADER(exif-data.h,
|
||||
AC_DEFINE(UNTAGGED_EXIF,1,[libexif includes don't need libexif prefix]))
|
||||
CPPFLAGS=$save_CPPFLAGS
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
fi
|
||||
|
||||
# make python binding?
|
||||
@ -967,11 +968,12 @@ file import with OpenSlide: $with_openslide
|
||||
(requires openslide-3.3.0 or later)
|
||||
file import with matio: $with_matio
|
||||
PDF import with poppler-glib: $with_poppler
|
||||
(requires poppler-glib 0.30.0 or later)
|
||||
(requires poppler-glib 0.16.0 or later)
|
||||
SVG import with librsvg-2.0: $with_rsvg
|
||||
(requires librsvg-2.0 2.40.0 or later)
|
||||
file import with cfitsio: $with_cfitsio
|
||||
file import/export with libwebp: $with_libwebp
|
||||
(requires libwebp-0.1.3 or later)
|
||||
text rendering with pangoft2: $with_pangoft2
|
||||
file import/export with libpng: $with_png
|
||||
(requires libpng-1.2.9 or later)
|
||||
|
@ -475,7 +475,7 @@ vips_hist_find_init( VipsHistFind *hist_find )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @band: band to equalise
|
||||
* * @band: band to equalise
|
||||
*
|
||||
* Find the histogram of @in. Find the histogram for band @band (producing a
|
||||
* one-band histogram), or for all bands (producing an n-band histogram) if
|
||||
|
@ -323,7 +323,7 @@ vips_hist_find_ndim_init( VipsHistFindNDim *ndim )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @bins: number of bins to make on each axis
|
||||
* * @bins: number of bins to make on each axis
|
||||
*
|
||||
* Make a one, two or three dimensional histogram of a 1, 2 or
|
||||
* 3 band image. Divide each axis into @bins bins .. ie.
|
||||
|
@ -275,9 +275,9 @@ vips_hough_circle_init( VipsHoughCircle *hough_circle )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @scale: scale down dimensions by this much
|
||||
* @min_radius: smallest radius to search for
|
||||
* @max_radius: largest radius to search for
|
||||
* * @scale: scale down dimensions by this much
|
||||
* * @min_radius: smallest radius to search for
|
||||
* * @max_radius: largest radius to search for
|
||||
*
|
||||
* Find the circular Hough transform of an image. @in must be one band, with
|
||||
* non-zero pixels for image edges. @out is three-band, with the third channel
|
||||
|
@ -169,8 +169,8 @@ vips_hough_line_init( VipsHoughLine *hough_line )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @width: horizontal size of parameter space
|
||||
* @height: vertical size of parameter space
|
||||
* * @width: horizontal size of parameter space
|
||||
* * @height: vertical size of parameter space
|
||||
*
|
||||
* Find the line Hough transform for @in. @in must have one band. @out has one
|
||||
* band, with pixels being the number of votes for that line. The X dimension
|
||||
|
@ -448,7 +448,7 @@ vips_linearv( VipsImage *in, VipsImage **out,
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @uchar: output uchar pixels
|
||||
* * @uchar: output uchar pixels
|
||||
*
|
||||
* Pass an image through a linear transform, ie. (@out = @in * @a + @b). Output
|
||||
* is float for integer input, double for double input, complex for
|
||||
@ -489,7 +489,7 @@ vips_linear( VipsImage *in, VipsImage **out, double *a, double *b, int n, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @uchar: output uchar pixels
|
||||
* * @uchar: output uchar pixels
|
||||
*
|
||||
* Run vips_linear() with a single constant.
|
||||
*
|
||||
|
@ -486,12 +486,12 @@ vips_max_init( VipsMax *max )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @x: horizontal position of maximum
|
||||
* @y: vertical position of maximum
|
||||
* @size: number of maxima to find
|
||||
* @out_array: return array of maximum values
|
||||
* @x_array: corresponding horizontal positions
|
||||
* @y_array: corresponding vertical positions
|
||||
* * @x: horizontal position of maximum
|
||||
* * @y: vertical position of maximum
|
||||
* * @size: number of maxima to find
|
||||
* * @out_array: return array of maximum values
|
||||
* * @x_array: corresponding horizontal positions
|
||||
* * @y_array: corresponding vertical positions
|
||||
*
|
||||
* This operation finds the maximum value in an image.
|
||||
*
|
||||
|
@ -269,10 +269,10 @@ vips_measure_init( VipsMeasure *measure )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @left: area of image containing chart
|
||||
* @top: area of image containing chart
|
||||
* @width: area of image containing chart
|
||||
* @height: area of image containing chart
|
||||
* * @left: area of image containing chart
|
||||
* * @top: area of image containing chart
|
||||
* * @width: area of image containing chart
|
||||
* * @height: area of image containing chart
|
||||
*
|
||||
* Analyse a grid of colour patches, producing an array of patch averages.
|
||||
* The mask has a row for each measured patch and a column for each image
|
||||
|
@ -489,12 +489,12 @@ vips_min_init( VipsMin *min )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @x: horizontal position of minimum
|
||||
* @y: vertical position of minimum
|
||||
* @size: number of minima to find
|
||||
* @out_array: return array of minimum values
|
||||
* @x_array: corresponding horizontal positions
|
||||
* @y_array: corresponding vertical positions
|
||||
* * @x: horizontal position of minimum
|
||||
* * @y: vertical position of minimum
|
||||
* * @size: number of minima to find
|
||||
* * @out_array: return array of minimum values
|
||||
* * @x_array: corresponding horizontal positions
|
||||
* * @y_array: corresponding vertical positions
|
||||
*
|
||||
* This operation finds the minimum value in an image.
|
||||
*
|
||||
|
@ -228,7 +228,6 @@ vips_colour_gen( VipsRegion *or,
|
||||
{
|
||||
VipsRegion **ir = (VipsRegion **) seq;
|
||||
VipsColour *colour = VIPS_COLOUR( b );
|
||||
VipsObjectClass *object_class = VIPS_OBJECT_GET_CLASS( colour );
|
||||
VipsColourClass *class = VIPS_COLOUR_GET_CLASS( colour );
|
||||
VipsRect *r = &or->valid;
|
||||
|
||||
@ -252,7 +251,7 @@ vips_colour_gen( VipsRegion *or,
|
||||
|
||||
VIPS_GATE_STOP( "vips_colour_gen: work" );
|
||||
|
||||
VIPS_COUNT_PIXELS( or, object_class->nickname );
|
||||
VIPS_COUNT_PIXELS( or, VIPS_OBJECT_GET_CLASS( colour )->nickname );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ vips_colourspace_init( VipsColourspace *colourspace )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @source_space: input colour space
|
||||
* * @source_space: input colour space
|
||||
*
|
||||
* This operation looks at the interpretation field of @in (or uses
|
||||
* @source_space, if set) and runs
|
||||
|
@ -1255,10 +1255,10 @@ vips_icc_ac2rc( VipsImage *in, VipsImage **out, const char *profile_filename )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @input_profile: get the input profile from here
|
||||
* @intent: transform with this intent
|
||||
* @embedded: use profile embedded in input image
|
||||
* @pcs: use XYZ or LAB PCS
|
||||
* * @input_profile: get the input profile from here
|
||||
* * @intent: transform with this intent
|
||||
* * @embedded: use profile embedded in input image
|
||||
* * @pcs: use XYZ or LAB PCS
|
||||
*
|
||||
* Import an image from device space to D65 LAB with an ICC profile. If @pcs is
|
||||
* set to #VIPS_PCS_XYZ, use CIE XYZ PCS instead.
|
||||
@ -1294,10 +1294,10 @@ vips_icc_import( VipsImage *in, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @intent: transform with this intent
|
||||
* @depth: depth of output image in bits
|
||||
* @output_profile: get the output profile from here
|
||||
* @pcs: use XYZ or LAB PCS
|
||||
* * @intent: transform with this intent
|
||||
* * @depth: depth of output image in bits
|
||||
* * @output_profile: get the output profile from here
|
||||
* * @pcs: use XYZ or LAB PCS
|
||||
*
|
||||
* Export an image from D65 LAB to device space with an ICC profile.
|
||||
* If @pcs is
|
||||
@ -1330,10 +1330,10 @@ vips_icc_export( VipsImage *in, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @input_profile: get the input profile from here
|
||||
* @intent: transform with this intent
|
||||
* @depth: depth of output image in bits
|
||||
* @embedded: use profile embedded in input image
|
||||
* * @input_profile: get the input profile from here
|
||||
* * @intent: transform with this intent
|
||||
* * @depth: depth of output image in bits
|
||||
* * @embedded: use profile embedded in input image
|
||||
*
|
||||
* Transform an image with a pair of ICC profiles. The input image is moved to
|
||||
* profile-connection space with the input profile and then to the output
|
||||
|
@ -268,7 +268,7 @@ vips_scRGB2BW_init( VipsscRGB2BW *scRGB2BW )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @depth: depth of output image in bits
|
||||
* * @depth: depth of output image in bits
|
||||
*
|
||||
* Convert an scRGB image to greyscale. Set @depth to 16 to get 16-bit output.
|
||||
*
|
||||
|
@ -296,7 +296,7 @@ vips_scRGB2sRGB_init( VipsscRGB2sRGB *scRGB2sRGB )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @depth: depth of output image in bits
|
||||
* * @depth: depth of output image in bits
|
||||
*
|
||||
* Convert an scRGB image to sRGB. Set @depth to 16 to get 16-bit output.
|
||||
*
|
||||
|
@ -397,13 +397,13 @@ vips_arrayjoinv( VipsImage **in, VipsImage **out, int n, va_list ap )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @across: number of images per row
|
||||
* @shim: space between images, in pixels
|
||||
* @background: background ink colour
|
||||
* @halign: low, centre or high alignment
|
||||
* @valign: low, centre or high alignment
|
||||
* @hspacing: horizontal distance between images
|
||||
* @vspacing: vertical distance between images
|
||||
* * @across: number of images per row
|
||||
* * @shim: space between images, in pixels
|
||||
* * @background: background ink colour
|
||||
* * @halign: low, centre or high alignment
|
||||
* * @valign: low, centre or high alignment
|
||||
* * @hspacing: horizontal distance between images
|
||||
* * @vspacing: vertical distance between images
|
||||
*
|
||||
* Lay out the images in @in in a grid. The grid is @across images across and
|
||||
* however high is necessary to use up all of @in. Images are set down
|
||||
|
@ -214,7 +214,7 @@ vips_autorot_init( VipsAutorot *autorot )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @angle: output #VipsAngle the image was rotated by
|
||||
* * @angle: output #VipsAngle the image was rotated by
|
||||
*
|
||||
* Look at the exif tags and rotate the image to make it upright. The
|
||||
* orientation tag is removed from @out to prevent accidental double rotation.
|
||||
|
@ -186,7 +186,7 @@ vips_bandfold_init( VipsBandfold *bandfold )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @factor: fold by this factor
|
||||
* * @factor: fold by this factor
|
||||
*
|
||||
* Fold up an image horizontally: width is collapsed into bands.
|
||||
* Use @factor to set how much to fold by: @factor 3, for example, will make
|
||||
|
@ -286,7 +286,7 @@ vips_bandrankv( VipsImage **in, VipsImage **out, int n, va_list ap )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @index: pick this index from list of sorted values
|
||||
* * @index: pick this index from list of sorted values
|
||||
*
|
||||
* Sorts the images @in band-element-wise, then outputs an
|
||||
* image in which each band element is selected from the sorted list by the
|
||||
|
@ -189,7 +189,7 @@ vips_bandunfold_init( VipsBandunfold *bandunfold )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @factor: unfold by this factor
|
||||
* * @factor: unfold by this factor
|
||||
*
|
||||
* Unfold image bands into x axis.
|
||||
* Use @factor to set how much to unfold by: @factor 3, for example, will make
|
||||
|
@ -144,9 +144,9 @@ vips_cache_init( VipsCache *cache )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @tile_width: width of tiles in cache
|
||||
* @tile_height: height of tiles in cache
|
||||
* @max_tiles: maximum number of tiles to cache
|
||||
* * @tile_width: width of tiles in cache
|
||||
* * @tile_height: height of tiles in cache
|
||||
* * @max_tiles: maximum number of tiles to cache
|
||||
*
|
||||
* This operation behaves rather like vips_copy() between images
|
||||
* @in and @out, except that it keeps a cache of computed pixels.
|
||||
|
@ -587,7 +587,7 @@ vips_castv( VipsImage *in, VipsImage **out, VipsBandFormat format, va_list ap )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @shift: integer values are shifted
|
||||
* * @shift: integer values are shifted
|
||||
*
|
||||
* Convert @in to @format. You can convert between any pair of formats.
|
||||
* Floats are truncated (not rounded). Out of range values are clipped.
|
||||
|
@ -366,16 +366,16 @@ vips_copy_init( VipsCopy *copy )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @width: set image width
|
||||
* @height: set image height
|
||||
* @bands: set image bands
|
||||
* @format: set image format
|
||||
* @coding: set image coding
|
||||
* @interpretation: set image interpretation
|
||||
* @xres: set image xres
|
||||
* @yres: set image yres
|
||||
* @xoffset: set image xoffset
|
||||
* @yoffset: set image yoffset
|
||||
* * @width: set image width
|
||||
* * @height: set image height
|
||||
* * @bands: set image bands
|
||||
* * @format: set image format
|
||||
* * @coding: set image coding
|
||||
* * @interpretation: set image interpretation
|
||||
* * @xres: set image xres
|
||||
* * @yres: set image yres
|
||||
* * @xoffset: set image xoffset
|
||||
* * @yoffset: set image yoffset
|
||||
*
|
||||
* Copy an image, optionally modifying the header. VIPS copies images by
|
||||
* copying pointers, so this operation is instant, even for very large images.
|
||||
|
@ -627,8 +627,8 @@ vips_embed_init( VipsEmbed *embed )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @extend: #VipsExtend to generate the edge pixels (default: black)
|
||||
* @background: #VipsArrayDouble colour for edge pixels
|
||||
* * @extend: #VipsExtend to generate the edge pixels (default: black)
|
||||
* * @background: #VipsArrayDouble colour for edge pixels
|
||||
*
|
||||
* The opposite of vips_extract_area(): embed @in within an image of size
|
||||
* @width by @height at position @x, @y.
|
||||
|
@ -455,7 +455,7 @@ vips_extract_band_init( VipsExtractBand *extract )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @n: number of bands to extract
|
||||
* * @n: number of bands to extract
|
||||
*
|
||||
* Extract a band or bands from an image. Extracting out of range is an error.
|
||||
*
|
||||
|
@ -409,8 +409,8 @@ vips_flatten_init( VipsFlatten *flatten )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @background: #VipsArrayDouble colour for new pixels
|
||||
* @max_alpha: %gdouble, maximum value for alpha
|
||||
* * @background: #VipsArrayDouble colour for new pixels
|
||||
* * @max_alpha: %gdouble, maximum value for alpha
|
||||
*
|
||||
* Take the last band of @in as an alpha and use it to blend the
|
||||
* remaining channels with @background.
|
||||
|
@ -168,7 +168,7 @@ vips_gamma_init( VipsGamma *gamma )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @exponent: gamma, default 1.0 / 2.4
|
||||
* * @exponent: gamma, default 1.0 / 2.4
|
||||
*
|
||||
* Calculate @in ** (1 / @exponent), normalising to the maximum range of the
|
||||
* input type. For float types use 1.0 as the maximum.
|
||||
|
@ -517,7 +517,7 @@ vips_ifthenelse_init( VipsIfthenelse *ifthenelse )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @blend: blend smoothly between @in1 and @in2
|
||||
* * @blend: blend smoothly between @in1 and @in2
|
||||
*
|
||||
* This operation scans the condition image @cond
|
||||
* and uses it to select pixels from either the then image @in1 or the else
|
||||
|
@ -573,8 +573,8 @@ vips_insert_init( VipsInsert *insert )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @expand: expand output to hold whole of both images
|
||||
* @background: colour for new pixels
|
||||
* * @expand: expand output to hold whole of both images
|
||||
* * @background: colour for new pixels
|
||||
*
|
||||
* Insert @sub into @main at position @x, @y.
|
||||
*
|
||||
|
@ -296,10 +296,10 @@ vips_join_init( VipsJoin *join )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @expand: %TRUE to expand the output image to hold all of the input pixels
|
||||
* @shim: space between images, in pixels
|
||||
* @background: background ink colour
|
||||
* @align: low, centre or high alignment
|
||||
* * @expand: %TRUE to expand the output image to hold all of the input pixels
|
||||
* * @shim: space between images, in pixels
|
||||
* * @background: background ink colour
|
||||
* * @align: low, centre or high alignment
|
||||
*
|
||||
* Join @in1 and @in2 together, left-right or up-down depending on the value
|
||||
* of @direction.
|
||||
|
@ -269,7 +269,7 @@ vips_msb_init( VipsMsb *msb )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @band: msb just this band
|
||||
* * @band: msb just this band
|
||||
*
|
||||
* Turn any integer image to 8-bit unsigned char by discarding all but the most
|
||||
* significant byte. Signed values are converted to unsigned by adding 128.
|
||||
|
@ -273,7 +273,7 @@ vips_premultiply_init( VipsPremultiply *premultiply )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @max_alpha: %gdouble, maximum value for alpha
|
||||
* * @max_alpha: %gdouble, maximum value for alpha
|
||||
*
|
||||
* Premultiplies any alpha channel.
|
||||
* The final band is taken to be the alpha
|
||||
|
@ -291,7 +291,7 @@ vips_rot45_init( VipsRot45 *rot45 )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @angle: rotation angle
|
||||
* * @angle: rotation angle
|
||||
*
|
||||
* Rotate @in by a multiple of 45 degrees. Odd-length sides and square images
|
||||
* only.
|
||||
|
@ -183,8 +183,8 @@ vips_scale_init( VipsScale *scale )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @log: log scale pixels
|
||||
* @exp: exponent for log scale
|
||||
* * @log: log scale pixels
|
||||
* * @exp: exponent for log scale
|
||||
*
|
||||
* Search the image for the maximum and minimum value, then return the image
|
||||
* as unsigned 8-bit, scaled so that the maximum value is 255 and the
|
||||
|
@ -364,9 +364,9 @@ vips_sequential_init( VipsSequential *sequential )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @trace: trace requests
|
||||
* @strip_height: height of cache strips
|
||||
* @access: access pattern
|
||||
* * @trace: trace requests
|
||||
* * @strip_height: height of cache strips
|
||||
* * @access: access pattern
|
||||
*
|
||||
* This operation behaves rather like vips_copy() between images
|
||||
* @in and @out, except that it checks that pixels are only requested
|
||||
|
@ -314,7 +314,7 @@ vips_subsample_init( VipsSubsample *subsample )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @point: turn on point sample mode
|
||||
* * @point: turn on point sample mode
|
||||
*
|
||||
* Subsample an image by an integer fraction. This is fast, nearest-neighbour
|
||||
* shrink.
|
||||
|
@ -824,12 +824,12 @@ vips_tile_cache_init( VipsTileCache *cache )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @tile_width: width of tiles in cache
|
||||
* @tile_height: height of tiles in cache
|
||||
* @max_tiles: maximum number of tiles to cache
|
||||
* @access: hint expected access pattern #VipsAccess
|
||||
* @threaded: allow many threads
|
||||
* @persistent: don't drop cache at end of computation
|
||||
* * @tile_width: width of tiles in cache
|
||||
* * @tile_height: height of tiles in cache
|
||||
* * @max_tiles: maximum number of tiles to cache
|
||||
* * @access: hint expected access pattern #VipsAccess
|
||||
* * @threaded: allow many threads
|
||||
* * @persistent: don't drop cache at end of computation
|
||||
*
|
||||
* This operation behaves rather like vips_copy() between images
|
||||
* @in and @out, except that it keeps a cache of computed pixels.
|
||||
@ -1018,9 +1018,9 @@ vips_line_cache_init( VipsLineCache *cache )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @access: hint expected access pattern #VipsAccess
|
||||
* @tile_height: height of tiles in cache
|
||||
* @threaded: allow many threads
|
||||
* * @access: hint expected access pattern #VipsAccess
|
||||
* * @tile_height: height of tiles in cache
|
||||
* * @threaded: allow many threads
|
||||
*
|
||||
* This operation behaves rather like vips_copy() between images
|
||||
* @in and @out, except that it keeps a cache of computed scanlines.
|
||||
|
@ -283,7 +283,7 @@ vips_unpremultiply_init( VipsUnpremultiply *unpremultiply )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @max_alpha: %gdouble, maximum value for alpha
|
||||
* * @max_alpha: %gdouble, maximum value for alpha
|
||||
*
|
||||
* Unpremultiplies any alpha channel.
|
||||
* The final band is taken to be the alpha
|
||||
|
@ -150,8 +150,8 @@ vips_wrap_init( VipsWrap *wrap )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @x: horizontal displacement
|
||||
* @y: vertical displacement
|
||||
* * @x: horizontal displacement
|
||||
* * @y: vertical displacement
|
||||
*
|
||||
* Slice an image up and move the segments about so that the pixel that was
|
||||
* at 0, 0 is now at @x, @y. If @x and @y are not set, they default to the
|
||||
|
@ -175,9 +175,9 @@ vips_conv_init( VipsConv *conv )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @precision: calculation accuracy
|
||||
* @layers: number of layers for approximation
|
||||
* @cluster: cluster lines closer than this distance
|
||||
* * @precision: calculation accuracy
|
||||
* * @layers: number of layers for approximation
|
||||
* * @cluster: cluster lines closer than this distance
|
||||
*
|
||||
* Convolution.
|
||||
*
|
||||
|
@ -143,9 +143,9 @@ vips_convsep_init( VipsConvsep *convsep )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @precision: calculation accuracy
|
||||
* @layers: number of layers for approximation
|
||||
* @cluster: cluster lines closer than this distance
|
||||
* * @precision: calculation accuracy
|
||||
* * @layers: number of layers for approximation
|
||||
* * @cluster: cluster lines closer than this distance
|
||||
*
|
||||
* Perform a separable convolution of @in with @mask.
|
||||
* See vips_conv() for a detailed description.
|
||||
|
@ -168,8 +168,8 @@ vips_gaussblur_init( VipsGaussblur *gaussblur )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @precision: #VipsPrecision for blur, default VIPS_PRECISION_INTEGER
|
||||
* @min_ampl: minimum amplitude, default 0.2
|
||||
* * @precision: #VipsPrecision for blur, default VIPS_PRECISION_INTEGER
|
||||
* * @min_ampl: minimum amplitude, default 0.2
|
||||
*
|
||||
* This operator runs vips_gaussmat() and vips_convsep() for you on an image.
|
||||
* Set @min_ampl smaller to generate a larger, more accurate mask. Set @sigma
|
||||
|
@ -394,12 +394,12 @@ vips_sharpen_init( VipsSharpen *sharpen )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @sigma: sigma of gaussian
|
||||
* @x1: flat/jaggy threshold
|
||||
* @y2: maximum amount of brightening
|
||||
* @y3: maximum amount of darkening
|
||||
* @m1: slope for flat areas
|
||||
* @m2: slope for jaggy areas
|
||||
* * @sigma: sigma of gaussian
|
||||
* * @x1: flat/jaggy threshold
|
||||
* * @y2: maximum amount of brightening
|
||||
* * @y3: maximum amount of darkening
|
||||
* * @m1: slope for flat areas
|
||||
* * @m2: slope for jaggy areas
|
||||
*
|
||||
* Selectively sharpen the L channel of a LAB image. The input image is
|
||||
* transformed to #VIPS_INTERPRETATION_LABS.
|
||||
|
@ -162,7 +162,7 @@ vips_black_init( VipsBlack *black )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @bands: output bands
|
||||
* * @bands: output bands
|
||||
*
|
||||
* Make a black unsigned char image of a specified size.
|
||||
*
|
||||
|
@ -123,8 +123,8 @@ vips_eye_init( VipsEye *eye )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @factor: maximum spatial frequency
|
||||
* @uchar: output a uchar image
|
||||
* * @factor: maximum spatial frequency
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Create a test pattern with increasing spatial frequence in X and
|
||||
* amplitude in Y. @factor should be between 0 and 1 and determines the
|
||||
|
@ -234,8 +234,8 @@ vips_gaussmat_init( VipsGaussmat *gaussmat )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @separable: generate a separable gaussian
|
||||
* @precision: #VipsPrecision for @out
|
||||
* * @separable: generate a separable gaussian
|
||||
* * @precision: #VipsPrecision for @out
|
||||
*
|
||||
* Creates a circularly symmetric Gaussian image of radius
|
||||
* @sigma. The size of the mask is determined by the variable @min_ampl;
|
||||
|
@ -195,8 +195,8 @@ vips_gaussnoise_init( VipsGaussnoise *gaussnoise )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @mean: mean of generated pixels
|
||||
* @sigma: standard deviation of generated pixels
|
||||
* * @mean: mean of generated pixels
|
||||
* * @sigma: standard deviation of generated pixels
|
||||
*
|
||||
* Make a one band float image of gaussian noise with the specified
|
||||
* distribution. The noise distribution is created by averaging 12 random
|
||||
|
@ -107,7 +107,7 @@ vips_grey_init( VipsGrey *grey )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @uchar: output a uchar image
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Create a one-band float image with the left-most column zero and the
|
||||
* right-most 1. Intermediate pixels are a linear ramp.
|
||||
|
@ -178,9 +178,9 @@ vips_identity_init( VipsIdentity *identity )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @bands: number of bands to create
|
||||
* @ushort: %TRUE for an unsigned short identity
|
||||
* @size: number of LUT elements for a ushort image
|
||||
* * @bands: number of bands to create
|
||||
* * @ushort: %TRUE for an unsigned short identity
|
||||
* * @size: number of LUT elements for a ushort image
|
||||
*
|
||||
* Creates an identity lookup table, ie. one which will leave an image
|
||||
* unchanged when applied with vips_maplut(). Each entry in the table has a
|
||||
|
@ -314,7 +314,7 @@ vips_invertlut_init( VipsInvertlut *lut )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @size: generate this much
|
||||
* * @size: generate this much
|
||||
*
|
||||
* Given a mask of target values and real values, generate a LUT which
|
||||
* will map reals to targets. Handy for linearising images from
|
||||
|
@ -251,8 +251,8 @@ vips_logmat_init( VipsLogmat *logmat )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @separable: generate a separable mask
|
||||
* @precision: #VipsPrecision for @out
|
||||
* * @separable: generate a separable mask
|
||||
* * @precision: #VipsPrecision for @out
|
||||
*
|
||||
* Creates a circularly symmetric Laplacian of Gaussian mask
|
||||
* of radius
|
||||
|
@ -127,10 +127,10 @@ vips_mask_butterworth_init( VipsMaskButterworth *butterworth )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Make an butterworth high- or low-pass filter, that is, one with a variable,
|
||||
* smooth transition
|
||||
|
@ -171,10 +171,10 @@ vips_mask_butterworth_band_init(
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Make an butterworth band-pass or band-reject filter, that is, one with a
|
||||
* variable, smooth transition positioned at @frequency_cutoff_x,
|
||||
|
@ -131,10 +131,10 @@ vips_mask_butterworth_ring_init(
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Make a butterworth ring-pass or ring-reject filter, that is, one with a
|
||||
* variable,
|
||||
|
@ -114,10 +114,10 @@ vips_mask_fractal_init( VipsMaskFractal *fractal )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* This operation should be used to create fractal images by filtering the
|
||||
* power spectrum of Gaussian white noise. See vips_gaussnoise().
|
||||
|
@ -116,10 +116,10 @@ vips_mask_gaussian_init( VipsMaskGaussian *gaussian )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Make a gaussian high- or low-pass filter, that is, one with a variable,
|
||||
* smooth transition positioned at @frequency_cutoff.
|
||||
|
@ -155,10 +155,10 @@ vips_mask_gaussian_band_init( VipsMaskGaussianBand *gaussian_band )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Make a gaussian band-pass or band-reject filter, that is, one with a
|
||||
* variable, smooth transition positioned at @frequency_cutoff_x,
|
||||
|
@ -124,10 +124,10 @@ vips_mask_gaussian_ring_init( VipsMaskGaussianRing *gaussian_ring )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Make a gaussian ring-pass or ring-reject filter, that is, one with a
|
||||
* variable, smooth transition positioned at @frequency_cutoff of width
|
||||
|
@ -105,10 +105,10 @@ vips_mask_ideal_init( VipsMaskIdeal *ideal )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Make an ideal high- or low-pass filter, that is, one with a sharp cutoff
|
||||
* positioned at @frequency_cutoff, where @frequency_cutoff is in
|
||||
|
@ -137,10 +137,10 @@ vips_mask_ideal_band_init( VipsMaskIdealBand *ideal_band )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Make an ideal band-pass or band-reject filter, that is, one with a
|
||||
* sharp cutoff around the point @frequency_cutoff_x, @frequency_cutoff_y,
|
||||
|
@ -120,10 +120,10 @@ vips_mask_ideal_ring_init( VipsMaskIdealRing *ideal_ring )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @nodc: don't set the DC pixel
|
||||
* @reject: invert the filter sense
|
||||
* @optical: coordinates in optical space
|
||||
* @uchar: output a uchar image
|
||||
* * @nodc: don't set the DC pixel
|
||||
* * @reject: invert the filter sense
|
||||
* * @optical: coordinates in optical space
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Make an ideal ring-pass or ring-reject filter, that is, one with a sharp
|
||||
* ring positioned at @frequency_cutoff of width @width, where
|
||||
|
@ -154,9 +154,9 @@ vips_sines_init( VipsSines *sines )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @hfreq: horizontal frequency
|
||||
* @vreq: vertical frequency
|
||||
* @uchar: output a uchar image
|
||||
* * @hfreq: horizontal frequency
|
||||
* * @vreq: vertical frequency
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Creates a float one band image of the a sine waveform in two
|
||||
* dimensions.
|
||||
|
@ -341,11 +341,11 @@ vips_text_init( VipsText *text )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @font: font to render with
|
||||
* @width: render within this many pixels across
|
||||
* @alignment: left/centre/right alignment
|
||||
* @dpi: render at this resolution
|
||||
* @spacing: space lines by this in points
|
||||
* * @font: font to render with
|
||||
* * @width: render within this many pixels across
|
||||
* * @alignment: left/centre/right alignment
|
||||
* * @dpi: render at this resolution
|
||||
* * @spacing: space lines by this in points
|
||||
*
|
||||
* Draw the string @text to an image. @out is a one-band 8-bit
|
||||
* unsigned char image, with 0 for no text and 255 for text. Values inbetween
|
||||
|
@ -315,16 +315,16 @@ vips_tonelut_init( VipsTonelut *lut )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @in_max: input range
|
||||
* @out_max: output range
|
||||
* @Lb: black-point [0-100]
|
||||
* @Lw: white-point [0-100]
|
||||
* @Ps: shadow point (eg. 0.2)
|
||||
* @Pm: mid-tone point (eg. 0.5)
|
||||
* @Ph: highlight point (eg. 0.8)
|
||||
* @S: shadow adjustment (+/- 30)
|
||||
* @M: mid-tone adjustment (+/- 30)
|
||||
* @H: highlight adjustment (+/- 30)
|
||||
* * @in_max: input range
|
||||
* * @out_max: output range
|
||||
* * @Lb: black-point [0-100]
|
||||
* * @Lw: white-point [0-100]
|
||||
* * @Ps: shadow point (eg. 0.2)
|
||||
* * @Pm: mid-tone point (eg. 0.5)
|
||||
* * @Ph: highlight point (eg. 0.8)
|
||||
* * @S: shadow adjustment (+/- 30)
|
||||
* * @M: mid-tone adjustment (+/- 30)
|
||||
* * @H: highlight adjustment (+/- 30)
|
||||
*
|
||||
* vips_tonelut() generates a tone curve for the adjustment of image
|
||||
* levels. It is mostly designed for adjusting the L* part of a LAB image in
|
||||
|
@ -246,9 +246,9 @@ vips_xyz_init( VipsXyz *xyz )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @csize: size for third dimension
|
||||
* @dsize: size for fourth dimension
|
||||
* @esize: size for fifth dimension
|
||||
* * @csize: size for third dimension
|
||||
* * @dsize: size for fourth dimension
|
||||
* * @esize: size for fifth dimension
|
||||
*
|
||||
* Create a two-band uint32 image where the elements in the first band have the
|
||||
* value of their x coordinate and elements in the second band have their y
|
||||
|
@ -106,7 +106,7 @@ vips_zone_init( VipsZone *zone )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @uchar: output a uchar image
|
||||
* * @uchar: output a uchar image
|
||||
*
|
||||
* Create a one-band image of a zone plate.
|
||||
*
|
||||
|
@ -294,7 +294,7 @@ vips_draw_circlev( VipsImage *image,
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @fill: fill the draw_circle
|
||||
* * @fill: fill the draw_circle
|
||||
*
|
||||
* Draws a circle on @image. If @fill is %TRUE then the circle is filled,
|
||||
* otherwise a 1-pixel-wide perimeter is drawn.
|
||||
@ -330,7 +330,7 @@ vips_draw_circle( VipsImage *image,
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @fill: fill the draw_circle
|
||||
* * @fill: fill the draw_circle
|
||||
*
|
||||
* As vips_draw_circle(), but just takes a single double for @ink.
|
||||
*
|
||||
|
@ -685,12 +685,12 @@ vips_draw_floodv( VipsImage *image,
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @test: test this image
|
||||
* @equal: fill while equal to edge
|
||||
* @left: output left edge of bounding box of modified area
|
||||
* @top: output top edge of bounding box of modified area
|
||||
* @width: output width of bounding box of modified area
|
||||
* @height: output height of bounding box of modified area
|
||||
* * @test: test this image
|
||||
* * @equal: fill while equal to edge
|
||||
* * @left: output left edge of bounding box of modified area
|
||||
* * @top: output top edge of bounding box of modified area
|
||||
* * @width: output width of bounding box of modified area
|
||||
* * @height: output height of bounding box of modified area
|
||||
*
|
||||
* Flood-fill @image with @ink, starting at position @x, @y. The filled area is
|
||||
* bounded by pixels that are equal to the ink colour, in other words, it
|
||||
@ -736,12 +736,12 @@ vips_draw_flood( VipsImage *image,
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @test: test this image
|
||||
* @equal: fill while equal to edge
|
||||
* @left: output left edge of bounding box of modified area
|
||||
* @top: output top edge of bounding box of modified area
|
||||
* @width: output width of bounding box of modified area
|
||||
* @height: output height of bounding box of modified area
|
||||
* * @test: test this image
|
||||
* * @equal: fill while equal to edge
|
||||
* * @left: output left edge of bounding box of modified area
|
||||
* * @top: output top edge of bounding box of modified area
|
||||
* * @width: output width of bounding box of modified area
|
||||
* * @height: output height of bounding box of modified area
|
||||
*
|
||||
* As vips_draw_flood(), but just takes a single double for @ink.
|
||||
*
|
||||
|
@ -300,7 +300,7 @@ vips_draw_image_init( VipsDrawImage *draw_image )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @mode: how to combine pixels
|
||||
* * @mode: how to combine pixels
|
||||
*
|
||||
* Draw @sub on top of @image at position @x, @y. The two images must have the
|
||||
* same Coding. If @sub has 1 band, the bands will be duplicated to match the
|
||||
|
@ -240,7 +240,7 @@ vips_draw_rectv( VipsImage *image,
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @fill: fill the rect
|
||||
* * @fill: fill the rect
|
||||
*
|
||||
* Paint pixels within @left, @top, @width, @height in @image with @ink. If
|
||||
* @fill is zero, just paint a 1-pixel-wide outline.
|
||||
@ -276,7 +276,7 @@ vips_draw_rect( VipsImage *image,
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @fill: fill the rect
|
||||
* * @fill: fill the rect
|
||||
*
|
||||
* As vips_draw_rect(), but just take a single double for @ink.
|
||||
*
|
||||
|
@ -2,6 +2,7 @@ noinst_LTLIBRARIES = libforeign.la
|
||||
|
||||
libforeign_la_SOURCES = \
|
||||
gifload.c \
|
||||
cairo.c \
|
||||
pdfload.c \
|
||||
svgload.c \
|
||||
radiance.h \
|
||||
|
66
libvips/foreign/cairo.c
Normal file
66
libvips/foreign/cairo.c
Normal file
@ -0,0 +1,66 @@
|
||||
/* Shared code for cairo based loaders like svgload and pdfload.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
This file is part of VIPS.
|
||||
|
||||
VIPS is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/internal.h>
|
||||
|
||||
/* Convert from ARGB to RGBA and undo premultiplication.
|
||||
*
|
||||
* See also openslide's argb2rgba().
|
||||
*/
|
||||
void
|
||||
vips__cairo2rgba( guint32 * restrict buf, int n )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < n; i++ ) {
|
||||
guint32 * restrict p = buf + i;
|
||||
guint32 x = *p;
|
||||
guint8 a = x >> 24;
|
||||
VipsPel * restrict out = (VipsPel *) p;
|
||||
|
||||
if( a == 255 )
|
||||
*p = GUINT32_TO_BE( (x << 8) | 255 );
|
||||
else if( a == 0 )
|
||||
*p = GUINT32_TO_BE( x << 8 );
|
||||
else {
|
||||
/* Undo premultiplication.
|
||||
*/
|
||||
out[0] = 255 * ((x >> 16) & 255) / a;
|
||||
out[1] = 255 * ((x >> 8) & 255) / a;
|
||||
out[2] = 255 * (x & 255) / a;
|
||||
out[3] = a;
|
||||
}
|
||||
}
|
||||
}
|
@ -187,10 +187,10 @@ vips_foreign_load_csv_init( VipsForeignLoadCsv *csv )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @skip: skip this many lines at start of file
|
||||
* @lines: read this many lines from file
|
||||
* @whitespace: set of whitespace characters
|
||||
* @separator: set of separator characters
|
||||
* * @skip: skip this many lines at start of file
|
||||
* * @lines: read this many lines from file
|
||||
* * @whitespace: set of whitespace characters
|
||||
* * @separator: set of separator characters
|
||||
*
|
||||
* Load a CSV (comma-separated values) file. The output image is always 1
|
||||
* band (monochrome), #VIPS_FORMAT_DOUBLE. Use vips_bandfold() to turn
|
||||
|
@ -128,7 +128,7 @@ vips_foreign_save_csv_init( VipsForeignSaveCsv *csv )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @separator: separator string
|
||||
* * @separator: separator string
|
||||
*
|
||||
* Writes the pixels in @in to the @filename as CSV (comma-separated values).
|
||||
* The image is written
|
||||
|
@ -2128,16 +2128,16 @@ vips_foreign_save_dz_init( VipsForeignSaveDz *dz )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @layout; directory layout convention
|
||||
* @suffix: suffix for tile tiles
|
||||
* @overlap; set tile overlap
|
||||
* @tile_size; set tile size
|
||||
* @background: background colour
|
||||
* @depth: how deep to make the pyramid
|
||||
* @centre: centre the tiles
|
||||
* @angle: rotate the image by this much
|
||||
* @container: set container type
|
||||
* @properties: write a properties file
|
||||
* * @layout; directory layout convention
|
||||
* * @suffix: suffix for tile tiles
|
||||
* * @overlap; set tile overlap
|
||||
* * @tile_size; set tile size
|
||||
* * @background: background colour
|
||||
* * @depth: how deep to make the pyramid
|
||||
* * @centre: centre the tiles
|
||||
* * @angle: rotate the image by this much
|
||||
* * @container: set container type
|
||||
* * @properties: write a properties file
|
||||
*
|
||||
* Save an image as a set of tiles at various resolutions. By default dzsave
|
||||
* uses DeepZoom layout -- use @layout to pick other conventions.
|
||||
|
@ -1823,8 +1823,8 @@ vips_vipssave( VipsImage *in, const char *filename, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @all_frames: %gboolean, load all frames in sequence
|
||||
* @density: string, canvas resolution for rendering vector formats like SVG
|
||||
* * @all_frames: %gboolean, load all frames in sequence
|
||||
* * @density: string, canvas resolution for rendering vector formats like SVG
|
||||
*
|
||||
* Read in an image using libMagick, the ImageMagick library. This library can
|
||||
* read more than 80 file formats, including SVG, BMP, EPS, DICOM and many
|
||||
@ -1870,8 +1870,8 @@ vips_magickload( const char *filename, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @all_frames: %gboolean, load all frames in sequence
|
||||
* @density: string, canvas resolution for rendering vector formats like SVG
|
||||
* * @all_frames: %gboolean, load all frames in sequence
|
||||
* * @density: string, canvas resolution for rendering vector formats like SVG
|
||||
*
|
||||
* Read an image memory block using libMagick into a VIPS image. Exactly as
|
||||
* vips_magickload(), but read from a memory source.
|
||||
@ -1911,7 +1911,7 @@ vips_magickload_buffer( void *buf, size_t len, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @page: int, load this page
|
||||
* * @page: int, load this page
|
||||
*
|
||||
* Read a TIFF file into a VIPS image. It is a full baseline TIFF 6 reader,
|
||||
* with extensions for tiled images, multipage images, LAB colour space,
|
||||
@ -1949,7 +1949,7 @@ vips_tiffload( const char *filename, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @page: %gint, load this page
|
||||
* * @page: %gint, load this page
|
||||
*
|
||||
* Read a TIFF-formatted memory block into a VIPS image. Exactly as
|
||||
* vips_tiffload(), but read from a memory source.
|
||||
@ -1989,20 +1989,20 @@ vips_tiffload_buffer( void *buf, size_t len, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @compression: use this #VipsForeignTiffCompression
|
||||
* @Q: %gint quality factor
|
||||
* @predictor: use this #VipsForeignTiffPredictor
|
||||
* @profile: filename of ICC profile to attach
|
||||
* @tile: set %TRUE to write a tiled tiff
|
||||
* @tile_width: %gint for tile size
|
||||
* @tile_height: %gint for tile size
|
||||
* @pyramid: set %TRUE to write an image pyramid
|
||||
* @squash: set %TRUE to squash 8-bit images down to 1 bit
|
||||
* @miniswhite: set %TRUE to write 1-bit images as MINISWHITE
|
||||
* @resunit: #VipsForeignTiffResunit for resolution unit
|
||||
* @xres: %gdouble horizontal resolution in pixels/mm
|
||||
* @yres: %gdouble vertical resolution in pixels/mm
|
||||
* @bigtiff: set %TRUE to write a BigTiff file
|
||||
* * @compression: use this #VipsForeignTiffCompression
|
||||
* * @Q: %gint quality factor
|
||||
* * @predictor: use this #VipsForeignTiffPredictor
|
||||
* * @profile: filename of ICC profile to attach
|
||||
* * @tile: set %TRUE to write a tiled tiff
|
||||
* * @tile_width: %gint for tile size
|
||||
* * @tile_height: %gint for tile size
|
||||
* * @pyramid: set %TRUE to write an image pyramid
|
||||
* * @squash: set %TRUE to squash 8-bit images down to 1 bit
|
||||
* * @miniswhite: set %TRUE to write 1-bit images as MINISWHITE
|
||||
* * @resunit: #VipsForeignTiffResunit for resolution unit
|
||||
* * @xres: %gdouble horizontal resolution in pixels/mm
|
||||
* * @yres: %gdouble vertical resolution in pixels/mm
|
||||
* * @bigtiff: set %TRUE to write a BigTiff file
|
||||
*
|
||||
* Write a VIPS image to a file as TIFF.
|
||||
*
|
||||
@ -2089,9 +2089,9 @@ vips_tiffsave( VipsImage *in, const char *filename, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @shrink: %gint, shrink by this much on load
|
||||
* @fail: %gboolean, fail on warnings
|
||||
* @autorotate: %gboolean, use exif Orientation tag to rotate the image during load
|
||||
* * @shrink: %gint, shrink by this much on load
|
||||
* * @fail: %gboolean, fail on warnings
|
||||
* * @autorotate: %gboolean, use exif Orientation tag to rotate the image during load
|
||||
*
|
||||
* Read a JPEG file into a VIPS image. It can read most 8-bit JPEG images,
|
||||
* including CMYK and YCbCr.
|
||||
@ -2167,8 +2167,8 @@ vips_jpegload( const char *filename, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @shrink: %gint, shrink by this much on load
|
||||
* @fail: %gboolean, fail on warnings
|
||||
* * @shrink: %gint, shrink by this much on load
|
||||
* * @fail: %gboolean, fail on warnings
|
||||
*
|
||||
* Read a JPEG-formatted memory block into a VIPS image. Exactly as
|
||||
* vips_jpegload(), but read from a memory buffer.
|
||||
@ -2208,15 +2208,16 @@ vips_jpegload_buffer( void *buf, size_t len, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @Q: %gint, quality factor
|
||||
* @profile: filename of ICC profile to attach
|
||||
* @optimize_coding: %gboolean, compute optimal Huffman coding tables
|
||||
* @interlace: %gboolean, write an interlaced (progressive) jpeg
|
||||
* @strip: %gboolean, remove all metadata from image
|
||||
* @no-subsample: %gboolean, disable chroma subsampling
|
||||
* @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
|
||||
* @overshoot_deringing: %gboolean, overshoot samples with extreme values
|
||||
* @optimize_scans: %gboolean, split DCT coefficients into separate scans
|
||||
* * @Q: %gint, quality factor
|
||||
* * @profile: filename of ICC profile to attach
|
||||
* * @optimize_coding: %gboolean, compute optimal Huffman coding tables
|
||||
* * @interlace: %gboolean, write an interlaced (progressive) jpeg
|
||||
* * @strip: %gboolean, remove all metadata from image
|
||||
* * @no-subsample: %gboolean, disable chroma subsampling
|
||||
* * @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
|
||||
* * @overshoot_deringing: %gboolean, overshoot samples with extreme values
|
||||
* * @optimize_scans: %gboolean, split DCT coefficients into separate scans
|
||||
* * @quant_table: %gint, quantization table index
|
||||
*
|
||||
* Write a VIPS image to a file as JPEG.
|
||||
*
|
||||
@ -2268,6 +2269,33 @@ vips_jpegload_buffer( void *buf, size_t len, VipsImage **out, ... )
|
||||
* (e.g. mozjpeg >= 3.0), split the spectrum of DCT coefficients into
|
||||
* separate scans. Reduces file size but increases compression time.
|
||||
*
|
||||
* If @quant_table is set and the version of libjpeg supports it
|
||||
* (e.g. mozjpeg >= 3.0) it selects the quantization table to use:
|
||||
*
|
||||
* * 0 — Tables from JPEG Annex K (vips and libjpeg default)
|
||||
* * 1 — Flat table
|
||||
* * 2 — Table tuned for MSSIM on Kodak image set
|
||||
* * 3 — Table from ImageMagick by N. Robidoux (current mozjpeg default)
|
||||
* * 4 — Table tuned for PSNR-HVS-M on Kodak image set
|
||||
* * 5 — Table from Relevance of Human Vision to JPEG-DCT Compression (1992)
|
||||
* * 6 — Table from DCTune Perceptual Optimization of Compressed Dental
|
||||
* X-Rays (1997)
|
||||
* * 7 — Table from A Visual Detection Model for DCT Coefficient
|
||||
* Quantization (1993)
|
||||
* * 8 — Table from An Improved Detection Model for DCT Coefficient
|
||||
* Quantization (1993)
|
||||
*
|
||||
* Quantization table 0 is the default in vips and libjpeg(-turbo), but it
|
||||
* tends to favor detail over color accuracy, producting colored patches and
|
||||
* stripes as well as heavy banding in flat areas at high compression ratios.
|
||||
* Quantization table 2 is a good candidate to try if the default quantization
|
||||
* table produces banding or color shifts and is well suited for hires images.
|
||||
* Quantization table 3 is the default in mozjpeg and has been tuned to produce
|
||||
* good results at the default quality setting; banding at high compression.
|
||||
* Quantization table 4 is the most accurate at the cost of compression ratio.
|
||||
* Tables 5-7 are based on older research papers, but generally achieve worse
|
||||
* compression ratios and/or quality than 2 or 4.
|
||||
*
|
||||
* See also: vips_jpegsave_buffer(), vips_image_write_to_file().
|
||||
*
|
||||
* Returns: 0 on success, -1 on error.
|
||||
@ -2294,15 +2322,16 @@ vips_jpegsave( VipsImage *in, const char *filename, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @Q: JPEG quality factor
|
||||
* @profile: attach this ICC profile
|
||||
* @optimize_coding: compute optimal Huffman coding tables
|
||||
* @interlace: write an interlaced (progressive) jpeg
|
||||
* @strip: remove all metadata from image
|
||||
* @no-subsample: disable chroma subsampling
|
||||
* @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
|
||||
* @overshoot_deringing: %gboolean, overshoot samples with extreme values
|
||||
* @optimize_scans: %gboolean, split DCT coefficients into separate scans
|
||||
* * @Q: JPEG quality factor
|
||||
* * @profile: attach this ICC profile
|
||||
* * @optimize_coding: compute optimal Huffman coding tables
|
||||
* * @interlace: write an interlaced (progressive) jpeg
|
||||
* * @strip: remove all metadata from image
|
||||
* * @no-subsample: disable chroma subsampling
|
||||
* * @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
|
||||
* * @overshoot_deringing: %gboolean, overshoot samples with extreme values
|
||||
* * @optimize_scans: %gboolean, split DCT coefficients into separate scans
|
||||
* * @quant_table: %gint, quantization table index
|
||||
*
|
||||
* As vips_jpegsave(), but save to a memory buffer.
|
||||
*
|
||||
@ -2349,14 +2378,15 @@ vips_jpegsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @Q: JPEG quality factor
|
||||
* @profile: attach this ICC profile
|
||||
* @optimize_coding: compute optimal Huffman coding tables
|
||||
* @strip: remove all metadata from image
|
||||
* @no-subsample: disable chroma subsampling
|
||||
* @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
|
||||
* @overshoot_deringing: %gboolean, overshoot samples with extreme values
|
||||
* @optimize_scans: %gboolean, split DCT coefficients into separate scans
|
||||
* * @Q: JPEG quality factor
|
||||
* * @profile: attach this ICC profile
|
||||
* * @optimize_coding: compute optimal Huffman coding tables
|
||||
* * @strip: remove all metadata from image
|
||||
* * @no-subsample: disable chroma subsampling
|
||||
* * @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
|
||||
* * @overshoot_deringing: %gboolean, overshoot samples with extreme values
|
||||
* * @optimize_scans: %gboolean, split DCT coefficients into separate scans
|
||||
* * @quant_table: %gint, quantization table index
|
||||
*
|
||||
* As vips_jpegsave(), but save as a mime jpeg on stdout.
|
||||
*
|
||||
@ -2385,7 +2415,7 @@ vips_jpegsave_mime( VipsImage *in, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @shrink: %gint, shrink by this much on load
|
||||
* * @shrink: %gint, shrink by this much on load
|
||||
*
|
||||
* Read a WebP file into a VIPS image.
|
||||
*
|
||||
@ -2417,7 +2447,7 @@ vips_webpload( const char *filename, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @shrink: %gint, shrink by this much on load
|
||||
* * @shrink: %gint, shrink by this much on load
|
||||
*
|
||||
* Read a WebP-formatted memory block into a VIPS image. Exactly as
|
||||
* vips_webpload(), but read from a memory buffer.
|
||||
@ -2457,7 +2487,28 @@ vips_webpload_buffer( void *buf, size_t len, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @Q: quality factor
|
||||
* * @Q: %gint quality factor
|
||||
* * @lossless: %gboolean enables lossless compression
|
||||
* * @preset: #VipsForeignWebpPreset choose lossy compression preset
|
||||
* * @smart_subsample: %gboolean enables high quality chroma subsampling
|
||||
* * @near_lossless: %gboolean use preprocessing in lossless mode (controlled by Q)
|
||||
* * @alpha_q: %gint set alpha quality in lossless mode
|
||||
*
|
||||
* Write an image to a file in WebP format.
|
||||
*
|
||||
* By default, images are saved in lossy format, with
|
||||
* @Q giving the WebP quality factor. It has the range 0 - 100, with the
|
||||
* default 75.
|
||||
*
|
||||
* Use @preset to hint the image type to the lossy compressor. The default is
|
||||
* #VIPS_FOREIGN_WEBP_PRESET_DEFAULT.
|
||||
* Set @smart_subsample to enable high quality chroma subsampling.
|
||||
* Use @alpha_q to set the quality for the alpha channel in lossy mode. It has
|
||||
* the range 1 - 100, with the default 100.
|
||||
*
|
||||
* Set @lossless to use lossless compression, or combine @near_lossless
|
||||
* with @Q 80, 60, 40 or 20 to apply increasing amounts of preprocessing
|
||||
* which improves the near-lossless compression ratio by up to 50%.
|
||||
*
|
||||
* See also: vips_webpload(), vips_image_write_to_file().
|
||||
*
|
||||
@ -2485,7 +2536,18 @@ vips_webpsave( VipsImage *in, const char *filename, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @Q: JPEG quality factor
|
||||
* * @Q: %gint quality factor
|
||||
* * @lossless: %gboolean enables lossless compression
|
||||
* * @preset: #VipsForeignWebpPreset choose lossy compression preset
|
||||
* * @smart_subsample: %gboolean enables high quality chroma subsampling
|
||||
* * @near_lossless: %gboolean use preprocessing in lossless mode (controlled by Q)
|
||||
* * @alpha_q: %gint set alpha quality in lossless mode
|
||||
*
|
||||
* As vips_webpsave(), but save to a memory buffer.
|
||||
*
|
||||
* The address of the buffer is returned in @obuf, the length of the buffer in
|
||||
* @olen. You are responsible for freeing the buffer with g_free() when you
|
||||
* are done with it.
|
||||
*
|
||||
* See also: vips_webpsave().
|
||||
*
|
||||
@ -2526,7 +2588,12 @@ vips_webpsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @Q: quality factor
|
||||
* * @Q: %gint quality factor
|
||||
* * @lossless: %gboolean enables lossless compression
|
||||
* * @preset: #VipsForeignWebpPreset choose lossy compression preset
|
||||
* * @smart_subsample: %gboolean enables high quality chroma subsampling
|
||||
* * @near_lossless: %gboolean use preprocessing in lossless mode (controlled by Q)
|
||||
* * @alpha_q: %gint set alpha quality in lossless mode
|
||||
*
|
||||
* As vips_webpsave(), but save as a mime webp on stdout.
|
||||
*
|
||||
@ -2587,9 +2654,9 @@ vips_openexrload( const char *filename, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @level: load this level
|
||||
* @associated: load this associated image
|
||||
* @autocrop: crop to image bounds
|
||||
* * @level: load this level
|
||||
* * @associated: load this associated image
|
||||
* * @autocrop: crop to image bounds
|
||||
*
|
||||
* Read a virtual slide supported by the OpenSlide library into a VIPS image.
|
||||
* OpenSlide supports images in Aperio, Hamamatsu, MIRAX, Sakura, Trestle,
|
||||
@ -2690,8 +2757,6 @@ vips_fitssave( VipsImage *in, const char *filename, ... )
|
||||
* @out: decompressed image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* Read a PNG file into a VIPS image. It can read all png images, including 8-
|
||||
* and 16-bit images, 1 and 3 channel, with and without an alpha channel.
|
||||
*
|
||||
@ -2762,10 +2827,10 @@ vips_pngload_buffer( void *buf, size_t len, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @compression: compression level
|
||||
* @interlace: interlace image
|
||||
* @profile: ICC profile to embed
|
||||
* @filter: #VipsForeignPngFilter row filter flag(s)
|
||||
* * @compression: compression level
|
||||
* * @interlace: interlace image
|
||||
* * @profile: ICC profile to embed
|
||||
* * @filter: #VipsForeignPngFilter row filter flag(s)
|
||||
*
|
||||
* Write a VIPS image to a file as PNG.
|
||||
*
|
||||
@ -2818,10 +2883,10 @@ vips_pngsave( VipsImage *in, const char *filename, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @compression: compression level
|
||||
* @interlace: interlace image
|
||||
* @profile: ICC profile to embed
|
||||
* @filter: libpng row filter flag(s)
|
||||
* * @compression: compression level
|
||||
* * @interlace: interlace image
|
||||
* * @profile: ICC profile to embed
|
||||
* * @filter: libpng row filter flag(s)
|
||||
*
|
||||
* As vips_pngsave(), but save to a memory buffer.
|
||||
*
|
||||
@ -2899,9 +2964,9 @@ vips_matload( const char *filename, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @page: %gint, load this page, numbered from zero
|
||||
* @dpi: %gdouble, render at this DPI
|
||||
* @scale: %gdouble, scale render by this factor
|
||||
* * @page: %gint, load this page, numbered from zero
|
||||
* * @dpi: %gdouble, render at this DPI
|
||||
* * @scale: %gdouble, scale render by this factor
|
||||
*
|
||||
* Render a PDF file into a VIPS image. Rendering uses the libpoppler library
|
||||
* and should be fast.
|
||||
@ -2960,9 +3025,9 @@ vips_pdfload( const char *filename, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @page: %gint, load this page, numbered from zero
|
||||
* @dpi: %gdouble, render at this DPI
|
||||
* @scale: %gdouble, scale render by this factor
|
||||
* * @page: %gint, load this page, numbered from zero
|
||||
* * @dpi: %gdouble, render at this DPI
|
||||
* * @scale: %gdouble, scale render by this factor
|
||||
*
|
||||
* Read a PDF-formatted memory block into a VIPS image. Exactly as
|
||||
* vips_pdfload(), but read from a memory buffer.
|
||||
@ -3002,8 +3067,8 @@ vips_pdfload_buffer( void *buf, size_t len, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @dpi: %gdouble, render at this DPI
|
||||
* @scale: %gdouble, scale render by this factor
|
||||
* * @dpi: %gdouble, render at this DPI
|
||||
* * @scale: %gdouble, scale render by this factor
|
||||
*
|
||||
* Render a SVG file into a VIPS image. Rendering uses the librsvg library
|
||||
* and should be fast.
|
||||
@ -3040,8 +3105,8 @@ vips_svgload( const char *filename, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @dpi: %gdouble, render at this DPI
|
||||
* @scale: %gdouble, scale render by this factor
|
||||
* * @dpi: %gdouble, render at this DPI
|
||||
* * @scale: %gdouble, scale render by this factor
|
||||
*
|
||||
* Read a SVG-formatted memory block into a VIPS image. Exactly as
|
||||
* vips_svgload(), but read from a memory buffer.
|
||||
@ -3081,7 +3146,7 @@ vips_svgload_buffer( void *buf, size_t len, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @page: %ginit, page (frame) to read
|
||||
* * @page: %ginit, page (frame) to read
|
||||
*
|
||||
* Read a GIF file into a VIPS image. Rendering uses the giflib library.
|
||||
*
|
||||
@ -3116,7 +3181,7 @@ vips_gifload( const char *filename, VipsImage **out, ... )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @page: %ginit, page (frame) to read
|
||||
* * @page: %ginit, page (frame) to read
|
||||
*
|
||||
* Read a GIF-formatted memory block into a VIPS image. Exactly as
|
||||
* vips_gifload(), but read from a memory buffer.
|
||||
|
@ -153,15 +153,33 @@ vips_foreign_load_gif_errstr( int error_code )
|
||||
#endif /*HAVE_GIFLIB_5*/
|
||||
}
|
||||
|
||||
static void
|
||||
vips_foreign_load_gif_error_vips( VipsForeignLoadGif *gif, int error )
|
||||
{
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif );
|
||||
|
||||
const char *message;
|
||||
|
||||
if( (message = vips_foreign_load_gif_errstr( error )) )
|
||||
vips_error( class->nickname, "%s", message );
|
||||
}
|
||||
|
||||
static void
|
||||
vips_foreign_load_gif_error( VipsForeignLoadGif *gif )
|
||||
{
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
|
||||
#ifdef HAVE_GIFLIB_5
|
||||
if( gif->file )
|
||||
vips_foreign_load_gif_errstr( gif->file->Error );
|
||||
error = gif->file->Error;
|
||||
#else
|
||||
vips_foreign_load_gif_errstr( GifLastError() );
|
||||
error = GifLastError();
|
||||
#endif
|
||||
|
||||
if( error )
|
||||
vips_foreign_load_gif_error_vips( gif, error );
|
||||
}
|
||||
|
||||
static void
|
||||
@ -172,13 +190,13 @@ vips_foreign_load_gif_close( VipsForeignLoadGif *gif )
|
||||
int error;
|
||||
|
||||
if( DGifCloseFile( gif->file, &error ) )
|
||||
vips_foreign_load_gif_errstr( error );
|
||||
vips_foreign_load_gif_error_vips( gif, error );
|
||||
gif->file = NULL;
|
||||
}
|
||||
#else
|
||||
if( gif->file ) {
|
||||
if( DGifCloseFile( gif->file ) )
|
||||
vips_foreign_load_gif_errstr( GifLastError() );
|
||||
vips_foreign_load_gif_error_vips( gif, GifLastError() );
|
||||
gif->file = NULL;
|
||||
}
|
||||
#endif
|
||||
@ -194,13 +212,13 @@ vips_foreign_load_gif_open( VipsForeignLoadGif *gif, const char *filename )
|
||||
int error;
|
||||
|
||||
if( !(gif->file = DGifOpenFileName( filename, &error )) ) {
|
||||
vips_foreign_load_gif_errstr( error );
|
||||
vips_foreign_load_gif_error_vips( gif, error );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
#else
|
||||
if( !(gif->file = DGifOpenFileName( filename )) ) {
|
||||
vips_foreign_load_gif_errstr( GifLastError() );
|
||||
vips_foreign_load_gif_error_vips( gif, GifLastError() );
|
||||
return( -1 );
|
||||
}
|
||||
#endif
|
||||
@ -218,13 +236,13 @@ vips_foreign_load_gif_open_buffer( VipsForeignLoadGif *gif, InputFunc read_fn )
|
||||
int error;
|
||||
|
||||
if( !(gif->file = DGifOpen( gif, read_fn, &error )) ) {
|
||||
vips_foreign_load_gif_errstr( error );
|
||||
vips_foreign_load_gif_error_vips( gif, error );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
#else
|
||||
if( !(gif->file = DGifOpen( gif, read_fn )) ) {
|
||||
vips_foreign_load_gif_errstr( GifLastError() );
|
||||
vips_foreign_load_gif_error_vips( gif, GifLastError() );
|
||||
return( -1 );
|
||||
}
|
||||
#endif
|
||||
@ -435,7 +453,7 @@ vips_foreign_load_gif_load( VipsForeignLoad *load )
|
||||
GifByteType *extension;
|
||||
int ext_code;
|
||||
|
||||
if( DGifGetRecordType( gif->file, &record) == GIF_ERROR ) {
|
||||
if( DGifGetRecordType( gif->file, &record ) == GIF_ERROR ) {
|
||||
vips_foreign_load_gif_error( gif );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -103,6 +103,10 @@ typedef struct _VipsForeignSaveJpeg {
|
||||
*/
|
||||
gboolean optimize_scans;
|
||||
|
||||
/* Use predefined quantization table with given index.
|
||||
*/
|
||||
int quant_table;
|
||||
|
||||
} VipsForeignSaveJpeg;
|
||||
|
||||
typedef VipsForeignSaveClass VipsForeignSaveJpegClass;
|
||||
@ -194,6 +198,13 @@ vips_foreign_save_jpeg_class_init( VipsForeignSaveJpegClass *class )
|
||||
G_STRUCT_OFFSET( VipsForeignSaveJpeg, optimize_scans ),
|
||||
FALSE );
|
||||
|
||||
VIPS_ARG_INT( class, "quant_table", 18,
|
||||
_( "Quantization table" ),
|
||||
_( "Use predefined quantization table with given index" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsForeignSaveJpeg, quant_table ),
|
||||
0, 8, 0 );
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -230,7 +241,8 @@ vips_foreign_save_jpeg_file_build( VipsObject *object )
|
||||
if( vips__jpeg_write_file( save->ready, file->filename,
|
||||
jpeg->Q, jpeg->profile, jpeg->optimize_coding,
|
||||
jpeg->interlace, save->strip, jpeg->no_subsample,
|
||||
jpeg->trellis_quant, jpeg->overshoot_deringing, jpeg->optimize_scans) )
|
||||
jpeg->trellis_quant, jpeg->overshoot_deringing,
|
||||
jpeg->optimize_scans, jpeg->quant_table ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
@ -294,7 +306,8 @@ vips_foreign_save_jpeg_buffer_build( VipsObject *object )
|
||||
if( vips__jpeg_write_buffer( save->ready,
|
||||
&obuf, &olen, jpeg->Q, jpeg->profile, jpeg->optimize_coding,
|
||||
jpeg->interlace, save->strip, jpeg->no_subsample,
|
||||
jpeg->trellis_quant, jpeg->overshoot_deringing, jpeg->optimize_scans) )
|
||||
jpeg->trellis_quant, jpeg->overshoot_deringing,
|
||||
jpeg->optimize_scans, jpeg->quant_table ) )
|
||||
return( -1 );
|
||||
|
||||
blob = vips_blob_new( (VipsCallbackFn) vips_free, obuf, olen );
|
||||
@ -357,7 +370,8 @@ vips_foreign_save_jpeg_mime_build( VipsObject *object )
|
||||
if( vips__jpeg_write_buffer( save->ready,
|
||||
&obuf, &olen, jpeg->Q, jpeg->profile, jpeg->optimize_coding,
|
||||
jpeg->interlace, save->strip, jpeg->no_subsample,
|
||||
jpeg->trellis_quant, jpeg->overshoot_deringing, jpeg->optimize_scans) )
|
||||
jpeg->trellis_quant, jpeg->overshoot_deringing,
|
||||
jpeg->optimize_scans, jpeg->quant_table ) )
|
||||
return( -1 );
|
||||
|
||||
printf( "Content-length: %zu\r\n", olen );
|
||||
|
@ -156,8 +156,8 @@ vips_foreign_save_ppm_init( VipsForeignSavePpm *ppm )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @ascii: save as ASCII rather than binary
|
||||
* @squash: squash 8-bit images down to one bit
|
||||
* * @ascii: save as ASCII rather than binary
|
||||
* * @squash: squash 8-bit images down to one bit
|
||||
*
|
||||
* Write a VIPS image to a file as PPM. It can write 1, 8, 16 or
|
||||
* 32 bit unsigned integer images, float images, colour or monochrome,
|
||||
|
@ -165,7 +165,7 @@ vips_foreign_load_raw_init( VipsForeignLoadRaw *raw )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @offset: offset in bytes from start of file
|
||||
* * @offset: offset in bytes from start of file
|
||||
*
|
||||
* This operation mmaps the file, setting @out so that access to that
|
||||
* image will read from the file.
|
||||
|
@ -149,34 +149,6 @@ vips_foreign_load_svg_header( VipsForeignLoad *load )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Convert from ARGB to RGBA and undo premultiplication.
|
||||
*/
|
||||
void
|
||||
vips__cairo2rgba( guint32 * restrict buf, int n )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < n; i++ ) {
|
||||
guint32 * restrict p = buf + i;
|
||||
guint32 x = *p;
|
||||
guint8 a = x >> 24;
|
||||
VipsPel * restrict out = (VipsPel *) p;
|
||||
|
||||
if( a == 255 )
|
||||
*p = GUINT32_TO_BE( (x << 8) | 255 );
|
||||
else if( a == 0 )
|
||||
*p = GUINT32_TO_BE( x << 8 );
|
||||
else {
|
||||
/* Undo premultiplication.
|
||||
*/
|
||||
out[0] = 255 * ((x >> 16) & 255) / a;
|
||||
out[1] = 255 * ((x >> 8) & 255) / a;
|
||||
out[2] = 255 * (x & 255) / a;
|
||||
out[3] = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
vips_foreign_load_svg_generate( VipsRegion *or,
|
||||
void *seq, void *a, void *b, gboolean *stop )
|
||||
|
@ -74,6 +74,8 @@
|
||||
* - don't write JFIF headers if we are stripping, thanks Benjamin
|
||||
* 13/4/16
|
||||
* - remove deleted exif fields more carefully
|
||||
* 9/5/16 felixbuenemann
|
||||
* - add quant_table
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -966,7 +968,7 @@ static int
|
||||
write_vips( Write *write, int qfac, const char *profile,
|
||||
gboolean optimize_coding, gboolean progressive, gboolean strip,
|
||||
gboolean no_subsample, gboolean trellis_quant,
|
||||
gboolean overshoot_deringing, gboolean optimize_scans )
|
||||
gboolean overshoot_deringing, gboolean optimize_scans, int quant_table )
|
||||
{
|
||||
VipsImage *in;
|
||||
J_COLOR_SPACE space;
|
||||
@ -1022,10 +1024,9 @@ write_vips( Write *write, int qfac, const char *profile,
|
||||
JINT_COMPRESS_PROFILE, JCP_FASTEST );
|
||||
#endif
|
||||
|
||||
/* Rest to default.
|
||||
/* Reset to default.
|
||||
*/
|
||||
jpeg_set_defaults( &write->cinfo );
|
||||
jpeg_set_quality( &write->cinfo, qfac, TRUE );
|
||||
|
||||
/* Compute optimal Huffman coding tables.
|
||||
*/
|
||||
@ -1077,6 +1078,18 @@ write_vips( Write *write, int qfac, const char *profile,
|
||||
vips_warn( "vips2jpeg", "%s",
|
||||
_( "Ignoring optimize_scans for baseline" ) );
|
||||
}
|
||||
|
||||
/* Use predefined quantization table.
|
||||
*/
|
||||
if( quant_table > 0 ) {
|
||||
if( jpeg_c_int_param_supported( &write->cinfo,
|
||||
JINT_BASE_QUANT_TBL_IDX ) )
|
||||
jpeg_c_set_int_param( &write->cinfo,
|
||||
JINT_BASE_QUANT_TBL_IDX, quant_table );
|
||||
else
|
||||
vips_warn( "vips2jpeg",
|
||||
"%s", _( "Setting quant_table unsupported" ) );
|
||||
}
|
||||
#else
|
||||
/* Using jpeglib.h without extension parameters, warn of ignored
|
||||
* options.
|
||||
@ -1088,8 +1101,14 @@ write_vips( Write *write, int qfac, const char *profile,
|
||||
"%s", _( "Ignoring overshoot_deringing" ) );
|
||||
if( optimize_scans )
|
||||
vips_warn( "vips2jpeg", "%s", _( "Ignoring optimize_scans" ) );
|
||||
if( quant_table > 0 )
|
||||
vips_warn( "vips2jpeg", "%s", _( "Ignoring quant_table" ) );
|
||||
#endif
|
||||
|
||||
/* Set compression quality. Must be called after setting params above.
|
||||
*/
|
||||
jpeg_set_quality( &write->cinfo, qfac, TRUE );
|
||||
|
||||
/* Enable progressive write.
|
||||
*/
|
||||
if( progressive )
|
||||
@ -1160,7 +1179,7 @@ vips__jpeg_write_file( VipsImage *in,
|
||||
const char *filename, int Q, const char *profile,
|
||||
gboolean optimize_coding, gboolean progressive, gboolean strip,
|
||||
gboolean no_subsample, gboolean trellis_quant,
|
||||
gboolean overshoot_deringing, gboolean optimize_scans )
|
||||
gboolean overshoot_deringing, gboolean optimize_scans, int quant_table )
|
||||
{
|
||||
Write *write;
|
||||
|
||||
@ -1192,7 +1211,7 @@ vips__jpeg_write_file( VipsImage *in,
|
||||
*/
|
||||
if( write_vips( write,
|
||||
Q, profile, optimize_coding, progressive, strip, no_subsample,
|
||||
trellis_quant, overshoot_deringing, optimize_scans ) ) {
|
||||
trellis_quant, overshoot_deringing, optimize_scans, quant_table ) ) {
|
||||
write_destroy( write );
|
||||
return( -1 );
|
||||
}
|
||||
@ -1446,7 +1465,7 @@ vips__jpeg_write_buffer( VipsImage *in,
|
||||
void **obuf, size_t *olen, int Q, const char *profile,
|
||||
gboolean optimize_coding, gboolean progressive,
|
||||
gboolean strip, gboolean no_subsample, gboolean trellis_quant,
|
||||
gboolean overshoot_deringing, gboolean optimize_scans )
|
||||
gboolean overshoot_deringing, gboolean optimize_scans, int quant_table )
|
||||
{
|
||||
Write *write;
|
||||
|
||||
@ -1477,7 +1496,7 @@ vips__jpeg_write_buffer( VipsImage *in,
|
||||
*/
|
||||
if( write_vips( write,
|
||||
Q, profile, optimize_coding, progressive, strip, no_subsample,
|
||||
trellis_quant, overshoot_deringing, optimize_scans ) ) {
|
||||
trellis_quant, overshoot_deringing, optimize_scans, quant_table ) ) {
|
||||
write_destroy( write );
|
||||
|
||||
return( -1 );
|
||||
|
@ -4,6 +4,8 @@
|
||||
* - from vips2jpeg.c
|
||||
* 31/5/16
|
||||
* - buffer write ignored lossless, thanks aaron42net
|
||||
* 2/5/16 Felix Bünemann
|
||||
* - used advanced encoding API, expose controls
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -46,6 +48,7 @@
|
||||
#ifdef HAVE_LIBWEBP
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
|
||||
@ -53,125 +56,162 @@
|
||||
|
||||
#include "webp.h"
|
||||
|
||||
typedef size_t (*webp_encoder)( const uint8_t *rgb,
|
||||
int width, int height, int stride,
|
||||
float quality_factor, uint8_t **output );
|
||||
typedef int (*webp_import)( WebPPicture *picture,
|
||||
const uint8_t *rgb, int stride );
|
||||
|
||||
typedef size_t (*webp_encoder_lossless)( const uint8_t *rgb,
|
||||
int width, int height, int stride, uint8_t **output );
|
||||
|
||||
int
|
||||
vips__webp_write_file( VipsImage *in, const char *filename,
|
||||
int Q, gboolean lossless )
|
||||
static WebPPreset
|
||||
get_preset( VipsForeignWebpPreset preset )
|
||||
{
|
||||
VipsImage *memory;
|
||||
size_t len;
|
||||
uint8_t *buffer;
|
||||
FILE *fp;
|
||||
switch( preset ) {
|
||||
case VIPS_FOREIGN_WEBP_PRESET_DEFAULT:
|
||||
return( WEBP_PRESET_DEFAULT );
|
||||
case VIPS_FOREIGN_WEBP_PRESET_PICTURE:
|
||||
return( WEBP_PRESET_PICTURE );
|
||||
case VIPS_FOREIGN_WEBP_PRESET_PHOTO:
|
||||
return( WEBP_PRESET_PHOTO );
|
||||
case VIPS_FOREIGN_WEBP_PRESET_DRAWING:
|
||||
return( WEBP_PRESET_DRAWING );
|
||||
case VIPS_FOREIGN_WEBP_PRESET_ICON:
|
||||
return( WEBP_PRESET_ICON );
|
||||
case VIPS_FOREIGN_WEBP_PRESET_TEXT:
|
||||
return( WEBP_PRESET_TEXT );
|
||||
|
||||
if( !(memory = vips_image_copy_memory( in )) )
|
||||
return( -1 );
|
||||
|
||||
if( lossless ) {
|
||||
webp_encoder_lossless encoder;
|
||||
|
||||
if( in->Bands == 4 )
|
||||
encoder = WebPEncodeLosslessRGBA;
|
||||
else
|
||||
encoder = WebPEncodeLosslessRGB;
|
||||
|
||||
if( !(len = encoder( VIPS_IMAGE_ADDR( memory, 0, 0 ),
|
||||
memory->Xsize, memory->Ysize,
|
||||
VIPS_IMAGE_SIZEOF_LINE( memory ),
|
||||
&buffer )) ) {
|
||||
VIPS_UNREF( memory );
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "unable to encode" ) );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
webp_encoder encoder;
|
||||
|
||||
if( in->Bands == 4 )
|
||||
encoder = WebPEncodeRGBA;
|
||||
else
|
||||
encoder = WebPEncodeRGB;
|
||||
|
||||
if( !(len = encoder( VIPS_IMAGE_ADDR( memory, 0, 0 ),
|
||||
memory->Xsize, memory->Ysize,
|
||||
VIPS_IMAGE_SIZEOF_LINE( memory ),
|
||||
Q, &buffer )) ) {
|
||||
VIPS_UNREF( memory );
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "unable to encode" ) );
|
||||
return( -1 );
|
||||
}
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
VIPS_UNREF( memory );
|
||||
|
||||
if( !(fp = vips__file_open_write( filename, FALSE )) ) {
|
||||
free( buffer );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( vips__file_write( buffer, len, 1, fp ) ) {
|
||||
fclose( fp );
|
||||
free( buffer );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
free( buffer );
|
||||
|
||||
return( 0 );
|
||||
/* Keep -Wall happy.
|
||||
*/
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
int
|
||||
vips__webp_write_buffer( VipsImage *in, void **obuf, size_t *olen,
|
||||
int Q, gboolean lossless )
|
||||
typedef struct {
|
||||
uint8_t *mem;
|
||||
size_t size;
|
||||
size_t max_size;
|
||||
} VipsWebPMemoryWriter;
|
||||
|
||||
static void
|
||||
init_memory_writer( VipsWebPMemoryWriter *writer ) {
|
||||
writer->mem = NULL;
|
||||
writer->size = 0;
|
||||
writer->max_size = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
memory_write( const uint8_t *data, size_t data_size,
|
||||
const WebPPicture *picture ) {
|
||||
VipsWebPMemoryWriter * const writer =
|
||||
(VipsWebPMemoryWriter*) picture->custom_ptr;
|
||||
|
||||
size_t next_size;
|
||||
|
||||
if( !writer )
|
||||
return( 0 );
|
||||
|
||||
next_size = writer->size + data_size;
|
||||
|
||||
if( next_size > writer->max_size ) {
|
||||
uint8_t *new_mem;
|
||||
const size_t next_max_size =
|
||||
VIPS_MAX( 8192, VIPS_MAX( next_size,
|
||||
writer->max_size * 2 ) );
|
||||
|
||||
if( !(new_mem = (uint8_t*) g_try_malloc( next_max_size )) )
|
||||
return( 0 );
|
||||
|
||||
if( writer->size > 0 )
|
||||
memcpy( new_mem, writer->mem, writer->size );
|
||||
|
||||
g_free( writer->mem );
|
||||
writer->mem = new_mem;
|
||||
writer->max_size = next_max_size;
|
||||
}
|
||||
|
||||
if( data_size > 0 ) {
|
||||
memcpy( writer->mem + writer->size, data, data_size );
|
||||
writer->size += data_size;
|
||||
}
|
||||
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
static int
|
||||
write_webp( WebPPicture *pic, VipsImage *in,
|
||||
int Q, gboolean lossless, VipsForeignWebpPreset preset,
|
||||
gboolean smart_subsample, gboolean near_lossless,
|
||||
int alpha_q )
|
||||
{
|
||||
VipsImage *memory;
|
||||
WebPConfig config;
|
||||
webp_import import;
|
||||
|
||||
if ( !WebPConfigPreset( &config, get_preset( preset ), Q ) ) {
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "config version error" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
|
||||
config.lossless = lossless || near_lossless;
|
||||
config.alpha_quality = alpha_q;
|
||||
/* Smart subsampling requires use_argb because
|
||||
* it is applied during RGB to YUV conversion.
|
||||
*/
|
||||
pic->use_argb = lossless || near_lossless || smart_subsample;
|
||||
#else
|
||||
if( lossless || near_lossless )
|
||||
vips_warn( "vips2webp",
|
||||
"%s", _( "lossless unsupported" ) );
|
||||
if( alpha_q != 100 )
|
||||
vips_warn( "vips2webp",
|
||||
"%s", _( "alpha_q unsupported" ) );
|
||||
#endif
|
||||
|
||||
#if WEBP_ENCODER_ABI_VERSION >= 0x0209
|
||||
if( near_lossless )
|
||||
config.near_lossless = Q;
|
||||
if( smart_subsample )
|
||||
config.preprocessing |= 4;
|
||||
#else
|
||||
if( near_lossless )
|
||||
vips_warn( "vips2webp",
|
||||
"%s", _( "near_lossless unsupported" ) );
|
||||
if( smart_subsample )
|
||||
vips_warn( "vips2webp",
|
||||
"%s", _( "smart_subsample unsupported" ) );
|
||||
#endif
|
||||
|
||||
if( !WebPValidateConfig( &config ) ) {
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "invalid configuration" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( !(memory = vips_image_copy_memory( in )) )
|
||||
return( -1 );
|
||||
|
||||
if( lossless ) {
|
||||
webp_encoder_lossless encoder;
|
||||
pic->width = memory->Xsize;
|
||||
pic->height = memory->Ysize;
|
||||
|
||||
if( in->Bands == 4 )
|
||||
encoder = WebPEncodeLosslessRGBA;
|
||||
else
|
||||
encoder = WebPEncodeLosslessRGB;
|
||||
if( in->Bands == 4 )
|
||||
import = WebPPictureImportRGBA;
|
||||
else
|
||||
import = WebPPictureImportRGB;
|
||||
|
||||
if( !(*olen = encoder( VIPS_IMAGE_ADDR( memory, 0, 0 ),
|
||||
memory->Xsize, memory->Ysize,
|
||||
VIPS_IMAGE_SIZEOF_LINE( memory ),
|
||||
(uint8_t **) obuf )) ) {
|
||||
VIPS_UNREF( memory );
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "unable to encode" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( !import( pic, VIPS_IMAGE_ADDR( memory, 0, 0 ),
|
||||
VIPS_IMAGE_SIZEOF_LINE( memory ) ) ) {
|
||||
VIPS_UNREF( memory );
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "picture memory error" ) );
|
||||
return( -1 );
|
||||
}
|
||||
else {
|
||||
webp_encoder encoder;
|
||||
|
||||
if( in->Bands == 4 )
|
||||
encoder = WebPEncodeRGBA;
|
||||
else
|
||||
encoder = WebPEncodeRGB;
|
||||
|
||||
if( !(*olen = encoder( VIPS_IMAGE_ADDR( memory, 0, 0 ),
|
||||
memory->Xsize, memory->Ysize,
|
||||
VIPS_IMAGE_SIZEOF_LINE( memory ),
|
||||
Q, (uint8_t **) obuf )) ) {
|
||||
VIPS_UNREF( memory );
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "unable to encode" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( !WebPEncode( &config, pic ) ) {
|
||||
VIPS_UNREF( memory );
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "unable to encode" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
VIPS_UNREF( memory );
|
||||
@ -179,4 +219,84 @@ vips__webp_write_buffer( VipsImage *in, void **obuf, size_t *olen,
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
vips__webp_write_file( VipsImage *in, const char *filename,
|
||||
int Q, gboolean lossless, VipsForeignWebpPreset preset,
|
||||
gboolean smart_subsample, gboolean near_lossless,
|
||||
int alpha_q )
|
||||
{
|
||||
WebPPicture pic;
|
||||
VipsWebPMemoryWriter writer;
|
||||
FILE *fp;
|
||||
|
||||
if( !WebPPictureInit( &pic ) ) {
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "picture version error" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
init_memory_writer( &writer );
|
||||
pic.writer = memory_write;
|
||||
pic.custom_ptr = &writer;
|
||||
|
||||
if( write_webp( &pic, in, Q, lossless, preset, smart_subsample,
|
||||
near_lossless, alpha_q ) ) {
|
||||
WebPPictureFree( &pic );
|
||||
g_free( writer.mem );
|
||||
return -1;
|
||||
}
|
||||
|
||||
WebPPictureFree( &pic );
|
||||
|
||||
if( !(fp = vips__file_open_write( filename, FALSE )) ) {
|
||||
g_free( writer.mem );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( vips__file_write( writer.mem, writer.size, 1, fp ) ) {
|
||||
fclose( fp );
|
||||
g_free( writer.mem );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
g_free( writer.mem );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
vips__webp_write_buffer( VipsImage *in, void **obuf, size_t *olen,
|
||||
int Q, gboolean lossless, VipsForeignWebpPreset preset,
|
||||
gboolean smart_subsample, gboolean near_lossless,
|
||||
int alpha_q )
|
||||
{
|
||||
WebPPicture pic;
|
||||
VipsWebPMemoryWriter writer;
|
||||
|
||||
if( !WebPPictureInit( &pic ) ) {
|
||||
vips_error( "vips2webp",
|
||||
"%s", _( "picture version error" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
init_memory_writer( &writer );
|
||||
pic.writer = memory_write;
|
||||
pic.custom_ptr = &writer;
|
||||
|
||||
if( write_webp( &pic, in, Q, lossless, preset, smart_subsample,
|
||||
near_lossless, alpha_q ) ) {
|
||||
WebPPictureFree( &pic );
|
||||
g_free( writer.mem );
|
||||
return -1;
|
||||
}
|
||||
|
||||
WebPPictureFree( &pic );
|
||||
|
||||
*obuf = writer.mem;
|
||||
*olen = writer.size;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#endif /*HAVE_LIBWEBP*/
|
||||
|
@ -41,12 +41,12 @@ int vips__jpeg_write_file( VipsImage *in,
|
||||
const char *filename, int Q, const char *profile,
|
||||
gboolean optimize_coding, gboolean progressive, gboolean strip,
|
||||
gboolean no_subsample, gboolean trellis_quant,
|
||||
gboolean overshoot_deringing, gboolean optimize_scans );
|
||||
gboolean overshoot_deringing, gboolean optimize_scans, int quant_table );
|
||||
int vips__jpeg_write_buffer( VipsImage *in,
|
||||
void **obuf, size_t *olen, int Q, const char *profile,
|
||||
gboolean optimize_coding, gboolean progressive, gboolean strip,
|
||||
gboolean no_subsample, gboolean trellis_quant,
|
||||
gboolean overshoot_deringing, gboolean optimize_scans );
|
||||
gboolean overshoot_deringing, gboolean optimize_scans, int quant_table );
|
||||
|
||||
int vips__isjpeg_buffer( const void *buf, size_t len );
|
||||
int vips__isjpeg( const char *filename );
|
||||
|
@ -49,9 +49,13 @@ int vips__webp_read_buffer( const void *buf, size_t len,
|
||||
VipsImage *out, int shrink );
|
||||
|
||||
int vips__webp_write_file( VipsImage *out, const char *filename,
|
||||
int Q, gboolean lossless );
|
||||
int Q, gboolean lossless, VipsForeignWebpPreset preset,
|
||||
gboolean smart_subsample, gboolean near_lossless,
|
||||
int alpha_q );
|
||||
int vips__webp_write_buffer( VipsImage *out, void **buf, size_t *len,
|
||||
int Q, gboolean lossless );
|
||||
int Q, gboolean lossless, VipsForeignWebpPreset preset,
|
||||
gboolean smart_subsample, gboolean near_lossless,
|
||||
int alpha_q );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -60,6 +60,22 @@ typedef struct _VipsForeignSaveWebp {
|
||||
*/
|
||||
gboolean lossless;
|
||||
|
||||
/* Lossy compression preset.
|
||||
*/
|
||||
VipsForeignWebpPreset preset;
|
||||
|
||||
/* Enable smart chroma subsampling.
|
||||
*/
|
||||
gboolean smart_subsample;
|
||||
|
||||
/* Use preprocessing in lossless mode.
|
||||
*/
|
||||
gboolean near_lossless;
|
||||
|
||||
/* Alpha quality.
|
||||
*/
|
||||
int alpha_q;
|
||||
|
||||
} VipsForeignSaveWebp;
|
||||
|
||||
typedef VipsForeignSaveClass VipsForeignSaveWebpClass;
|
||||
@ -100,7 +116,7 @@ vips_foreign_save_webp_class_init( VipsForeignSaveWebpClass *class )
|
||||
_( "Q factor" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsForeignSaveWebp, Q ),
|
||||
1, 100, 75 );
|
||||
0, 100, 75 );
|
||||
|
||||
VIPS_ARG_BOOL( class, "lossless", 11,
|
||||
_( "lossless" ),
|
||||
@ -109,12 +125,42 @@ vips_foreign_save_webp_class_init( VipsForeignSaveWebpClass *class )
|
||||
G_STRUCT_OFFSET( VipsForeignSaveWebp, lossless ),
|
||||
FALSE );
|
||||
|
||||
VIPS_ARG_ENUM( class, "preset", 12,
|
||||
_( "preset" ),
|
||||
_( "Preset for lossy compression" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsForeignSaveWebp, preset ),
|
||||
VIPS_TYPE_FOREIGN_WEBP_PRESET,
|
||||
VIPS_FOREIGN_WEBP_PRESET_DEFAULT );
|
||||
|
||||
VIPS_ARG_BOOL( class, "smart_subsample", 13,
|
||||
_( "Smart subsampling" ),
|
||||
_( "Enable high quality chroma subsampling" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsForeignSaveWebp, smart_subsample ),
|
||||
FALSE );
|
||||
|
||||
VIPS_ARG_BOOL( class, "near_lossless", 14,
|
||||
_( "Near lossless" ),
|
||||
_( "Enable preprocessing in lossless mode (uses Q)" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsForeignSaveWebp, near_lossless ),
|
||||
FALSE );
|
||||
|
||||
VIPS_ARG_INT( class, "alpha_q", 15,
|
||||
_( "Alpha quality" ),
|
||||
_( "Change alpha plane fidelity for lossy compression" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsForeignSaveWebp, alpha_q ),
|
||||
0, 100, 100 );
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
vips_foreign_save_webp_init( VipsForeignSaveWebp *webp )
|
||||
{
|
||||
webp->Q = 80;
|
||||
webp->Q = 75;
|
||||
webp->alpha_q = 100;
|
||||
}
|
||||
|
||||
typedef struct _VipsForeignSaveWebpFile {
|
||||
@ -143,7 +189,9 @@ vips_foreign_save_webp_file_build( VipsObject *object )
|
||||
return( -1 );
|
||||
|
||||
if( vips__webp_write_file( save->ready, file->filename,
|
||||
webp->Q, webp->lossless ) )
|
||||
webp->Q, webp->lossless, webp->preset,
|
||||
webp->smart_subsample, webp->near_lossless,
|
||||
webp->alpha_q ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
@ -205,7 +253,9 @@ vips_foreign_save_webp_buffer_build( VipsObject *object )
|
||||
return( -1 );
|
||||
|
||||
if( vips__webp_write_buffer( save->ready, &obuf, &olen,
|
||||
webp->Q, webp->lossless ) )
|
||||
webp->Q, webp->lossless, webp->preset,
|
||||
webp->smart_subsample, webp->near_lossless,
|
||||
webp->alpha_q ) )
|
||||
return( -1 );
|
||||
|
||||
blob = vips_blob_new( (VipsCallbackFn) vips_free, obuf, olen );
|
||||
@ -266,7 +316,9 @@ vips_foreign_save_webp_mime_build( VipsObject *object )
|
||||
return( -1 );
|
||||
|
||||
if( vips__webp_write_buffer( save->ready, &obuf, &olen,
|
||||
webp->Q, webp->lossless ) )
|
||||
webp->Q, webp->lossless, webp->preset,
|
||||
webp->smart_subsample, webp->near_lossless,
|
||||
webp->alpha_q ) )
|
||||
return( -1 );
|
||||
|
||||
printf( "Content-length: %zu\r\n", olen );
|
||||
|
@ -276,7 +276,7 @@ vips_invfft_init( VipsInvfft *invfft )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @real: only output the real part
|
||||
* * @real: only output the real part
|
||||
*
|
||||
* Transform an image from Fourier space to real space. The result is complex.
|
||||
* If you are OK with a real result, set @real, it's quicker.
|
||||
|
@ -138,7 +138,7 @@ vips_hist_equal_init( VipsHistEqual *equal )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @band: band to equalise
|
||||
* * @band: band to equalise
|
||||
*
|
||||
* Histogram-equalise @in. Equalise using band @bandno, or if @bandno is -1,
|
||||
* equalise bands independently.
|
||||
|
@ -735,7 +735,7 @@ vips_maplut_init( VipsMaplut *maplut )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @band: apply one-band @lut to this band of @in
|
||||
* * @band: apply one-band @lut to this band of @in
|
||||
*
|
||||
* Map an image through another image acting as a LUT (Look Up Table).
|
||||
* The lut may have any type and the output image will be that type.
|
||||
|
@ -367,10 +367,10 @@ vips_stdif_init( VipsStdif *stdif )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @a: weight of new mean
|
||||
* @m0: target mean
|
||||
* @b: weight of new deviation
|
||||
* @s0: target deviation
|
||||
* * @a: weight of new mean
|
||||
* * @m0: target mean
|
||||
* * @b: weight of new deviation
|
||||
* * @s0: target deviation
|
||||
*
|
||||
* vips_stdif() preforms statistical differencing according to the formula
|
||||
* given in page 45 of the book "An Introduction to Digital Image
|
||||
|
@ -14,6 +14,8 @@ GType vips_foreign_flags_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_FOREIGN_FLAGS (vips_foreign_flags_get_type())
|
||||
GType vips_saveable_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_SAVEABLE (vips_saveable_get_type())
|
||||
GType vips_foreign_webp_preset_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_FOREIGN_WEBP_PRESET (vips_foreign_webp_preset_get_type())
|
||||
GType vips_foreign_tiff_compression_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_FOREIGN_TIFF_COMPRESSION (vips_foreign_tiff_compression_get_type())
|
||||
GType vips_foreign_tiff_predictor_get_type (void) G_GNUC_CONST;
|
||||
|
@ -338,6 +338,27 @@ int vips_jpegsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
|
||||
int vips_jpegsave_mime( VipsImage *in, ... )
|
||||
__attribute__((sentinel));
|
||||
|
||||
/**
|
||||
* VipsForeignWebpPreset:
|
||||
* @VIPS_FOREIGN_WEBP_PRESET_DEFAULT: default preset
|
||||
* @VIPS_FOREIGN_WEBP_PRESET_PICTURE: digital picture, like portrait, inner shot
|
||||
* @VIPS_FOREIGN_WEBP_PRESET_PHOTO: outdoor photograph, with natural lighting
|
||||
* @VIPS_FOREIGN_WEBP_PRESET_DRAWING: hand or line drawing, with high-contrast details
|
||||
* @VIPS_FOREIGN_WEBP_PRESET_ICON: small-sized colorful images
|
||||
* @VIPS_FOREIGN_WEBP_PRESET_TEXT: text-like
|
||||
*
|
||||
* Tune lossy encoder settings for different image types.
|
||||
*/
|
||||
typedef enum {
|
||||
VIPS_FOREIGN_WEBP_PRESET_DEFAULT,
|
||||
VIPS_FOREIGN_WEBP_PRESET_PICTURE,
|
||||
VIPS_FOREIGN_WEBP_PRESET_PHOTO,
|
||||
VIPS_FOREIGN_WEBP_PRESET_DRAWING,
|
||||
VIPS_FOREIGN_WEBP_PRESET_ICON,
|
||||
VIPS_FOREIGN_WEBP_PRESET_TEXT,
|
||||
VIPS_FOREIGN_WEBP_PRESET_LAST
|
||||
} VipsForeignWebpPreset;
|
||||
|
||||
int vips_webpload( const char *filename, VipsImage **out, ... )
|
||||
__attribute__((sentinel));
|
||||
int vips_webpload_buffer( void *buf, size_t len, VipsImage **out, ... )
|
||||
|
@ -70,6 +70,28 @@ vips_saveable_get_type( void )
|
||||
return( etype );
|
||||
}
|
||||
GType
|
||||
vips_foreign_webp_preset_get_type( void )
|
||||
{
|
||||
static GType etype = 0;
|
||||
|
||||
if( etype == 0 ) {
|
||||
static const GEnumValue values[] = {
|
||||
{VIPS_FOREIGN_WEBP_PRESET_DEFAULT, "VIPS_FOREIGN_WEBP_PRESET_DEFAULT", "default"},
|
||||
{VIPS_FOREIGN_WEBP_PRESET_PICTURE, "VIPS_FOREIGN_WEBP_PRESET_PICTURE", "picture"},
|
||||
{VIPS_FOREIGN_WEBP_PRESET_PHOTO, "VIPS_FOREIGN_WEBP_PRESET_PHOTO", "photo"},
|
||||
{VIPS_FOREIGN_WEBP_PRESET_DRAWING, "VIPS_FOREIGN_WEBP_PRESET_DRAWING", "drawing"},
|
||||
{VIPS_FOREIGN_WEBP_PRESET_ICON, "VIPS_FOREIGN_WEBP_PRESET_ICON", "icon"},
|
||||
{VIPS_FOREIGN_WEBP_PRESET_TEXT, "VIPS_FOREIGN_WEBP_PRESET_TEXT", "text"},
|
||||
{VIPS_FOREIGN_WEBP_PRESET_LAST, "VIPS_FOREIGN_WEBP_PRESET_LAST", "last"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
etype = g_enum_register_static( "VipsForeignWebpPreset", values );
|
||||
}
|
||||
|
||||
return( etype );
|
||||
}
|
||||
GType
|
||||
vips_foreign_tiff_compression_get_type( void )
|
||||
{
|
||||
static GType etype = 0;
|
||||
|
@ -433,10 +433,10 @@ vips_image_guess_format( const VipsImage *image )
|
||||
break;
|
||||
|
||||
case VIPS_INTERPRETATION_CMYK:
|
||||
if( image->BandFmt != VIPS_FORMAT_USHORT )
|
||||
format = VIPS_FORMAT_UCHAR;
|
||||
if( image->BandFmt == VIPS_FORMAT_USHORT )
|
||||
format = VIPS_FORMAT_USHORT;
|
||||
else
|
||||
format = image->BandFmt;
|
||||
format = VIPS_FORMAT_UCHAR;
|
||||
break;
|
||||
|
||||
case VIPS_INTERPRETATION_LABQ:
|
||||
@ -453,14 +453,15 @@ vips_image_guess_format( const VipsImage *image )
|
||||
break;
|
||||
|
||||
case VIPS_INTERPRETATION_MATRIX:
|
||||
if( image->BandFmt != VIPS_FORMAT_DOUBLE )
|
||||
format = VIPS_FORMAT_FLOAT;
|
||||
if( image->BandFmt == VIPS_FORMAT_DOUBLE )
|
||||
format = VIPS_FORMAT_DOUBLE;
|
||||
else
|
||||
format = image->BandFmt;
|
||||
format = VIPS_FORMAT_FLOAT;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
format = VIPS_FORMAT_NOTSET;
|
||||
break;
|
||||
}
|
||||
|
||||
return( format );
|
||||
|
@ -1837,8 +1837,8 @@ vips_filename_get_options( const char *vips_filename )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @access: hint #VipsAccess mode to loader
|
||||
* @disc: load via a temporary disc file
|
||||
* * @access: hint #VipsAccess mode to loader
|
||||
* * @disc: load via a temporary disc file
|
||||
*
|
||||
* vips_image_new_from_file() opens @name for reading. It can load files
|
||||
* in many image formats, including VIPS, TIFF, PNG, JPEG, FITS, Matlab,
|
||||
|
@ -329,11 +329,11 @@ vips_system_init( VipsSystem *system )
|
||||
*
|
||||
* Optional arguments:
|
||||
*
|
||||
* @in: array of input images
|
||||
* @out: output image
|
||||
* @in_format: write input files like this
|
||||
* @out_format: write output filename like this
|
||||
* @log: stdout of command is returned here
|
||||
* * @in: array of input images
|
||||
* * @out: output image
|
||||
* * @in_format: write input files like this
|
||||
* * @out_format: write output filename like this
|
||||
* * @log: stdout of command is returned here
|
||||
*
|
||||
* vips_system() runs a command, optionally passing a set of images in and
|
||||
* optionally getting an image back. The command's stdout is returned in @log.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user