diff --git a/binding.gyp b/binding.gyp index f38c5215..fac6dc78 100644 --- a/binding.gyp +++ b/binding.gyp @@ -267,7 +267,7 @@ 'vendor/lib/libstdc++-6.dll', 'vendor/lib/libtiff-5.dll', 'vendor/lib/libvips-42.dll', - 'vendor/lib/libwebp-6.dll', + 'vendor/lib/libwebp-7.dll', 'vendor/lib/libxml2-2.dll', 'vendor/lib/zlib1.dll' ] diff --git a/docs/install.md b/docs/install.md index 4536e7fc..55b17df0 100644 --- a/docs/install.md +++ b/docs/install.md @@ -20,7 +20,7 @@ yarn add sharp [![Linux Build Status](https://circleci.com/gh/lovell/sharp.svg?style=svg&circle-token=6cb6d1d287a51af83722b19ed8885377fbc85e5c)](https://circleci.com/gh/lovell/sharp) libvips and its dependencies are fetched and stored within `node_modules/sharp/vendor` during `npm install`. -This involves an automated HTTPS download of approximately 6.5MB. +This involves an automated HTTPS download of approximately 7MB. Most recent Linux-based operating systems with glibc running on x64 and ARMv6+ CPUs should "just work", e.g.: @@ -57,7 +57,7 @@ via `sharp.cache(false)` to avoid a stack overflow. [![OS X 10.9.5 Build Status](https://travis-ci.org/lovell/sharp.png?branch=master)](https://travis-ci.org/lovell/sharp) libvips and its dependencies are fetched and stored within `node_modules/sharp/vendor` during `npm install`. -This involves an automated HTTPS download of approximately 6.3MB. +This involves an automated HTTPS download of approximately 7MB. To use your own version of libvips instead of the provided binaries, make sure it is at least the version listed under `config.libvips` in the `package.json` file and @@ -68,7 +68,7 @@ that it can be located using `pkg-config --modversion vips-cpp`. [![Windows x64 Build Status](https://ci.appveyor.com/api/projects/status/pgtul704nkhhg6sg)](https://ci.appveyor.com/project/lovell/sharp) libvips and its dependencies are fetched and stored within `node_modules\sharp\vendor` during `npm install`. -This involves an automated HTTPS download of approximately 9MB. +This involves an automated HTTPS download of approximately 11MB. Only 64-bit (x64) `node.exe` is supported. @@ -84,7 +84,7 @@ cd /usr/ports/graphics/vips/ && make install clean ### Heroku libvips and its dependencies are fetched and stored within `node_modules\sharp\vendor` during `npm install`. -This involves an automated HTTPS download of approximately 6.5MB. +This involves an automated HTTPS download of approximately 7MB. Set [NODE_MODULES_CACHE](https://devcenter.heroku.com/articles/nodejs-support#cache-behavior) to `false` when using the `yarn` package manager. @@ -199,6 +199,7 @@ Use of libraries under the terms of the LGPLv3 is via the | Library | Used under the terms of | |---------------|----------------------------------------------------------------------------------------------------------| | cairo | Mozilla Public License 2.0 | +| expat | MIT Licence | | fontconfig | [fontconfig Licence](https://cgit.freedesktop.org/fontconfig/tree/COPYING) (BSD-like) | | freetype | [freetype Licence](http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT) (BSD-like) | | giflib | MIT Licence | diff --git a/package.json b/package.json index 8fd5118a..cc3f92bc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "sharp", "description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP and TIFF images", - "version": "0.17.3", + "version": "0.18.0-alpha", "author": "Lovell Fuller ", "homepage": "https://github.com/lovell/sharp", "contributors": [ @@ -38,7 +38,7 @@ ], "scripts": { "clean": "rm -rf node_modules/ build/ vendor/ coverage/ test/fixtures/output.*", - "test": "semistandard && cc && cross-env VIPS_WARNING=0 nyc --reporter=lcov --branches=99 mocha --slow=5000 --timeout=60000 ./test/unit/*.js", + "test": "semistandard && cc && nyc --reporter=lcov --branches=99 mocha --slow=5000 --timeout=60000 ./test/unit/*.js", "test-leak": "./test/leak/leak.sh", "test-packaging": "./packaging/test-linux-x64.sh", "docs": "for m in constructor input resize composite operation colour channel output utility; do documentation build --shallow --format=md lib/$m.js >docs/api-$m.md; done" @@ -72,10 +72,9 @@ "tar": "^2.2.1" }, "devDependencies": { - "async": "^2.2.0", + "async": "^2.3.0", "bufferutil": "^3.0.0", "cc": "^1.0.0", - "cross-env": "^4.0.0", "documentation": "^4.0.0-beta.18", "exif-reader": "^1.0.2", "icc": "^1.0.0", @@ -87,7 +86,7 @@ }, "license": "Apache-2.0", "config": { - "libvips": "8.4.2" + "libvips": "8.5.1" }, "engines": { "node": ">=4" diff --git a/packaging/build.sh b/packaging/build.sh index 5fd63e95..7c8364cb 100755 --- a/packaging/build.sh +++ b/packaging/build.sh @@ -23,6 +23,11 @@ if ! type docker >/dev/null; then exit 1 fi +# Update base images +for baseimage in debian:wheezy debian:jessie debian:stretch socialdefect/raspbian-jessie-core; do + docker pull $baseimage +done + # Windows (x64) if [ $PLATFORM = "all" ] || [ $PLATFORM = "win32-x64" ]; then echo "Building win32-x64..." diff --git a/packaging/build/lin.sh b/packaging/build/lin.sh index 2ec75d4d..22750be5 100755 --- a/packaging/build/lin.sh +++ b/packaging/build/lin.sh @@ -16,25 +16,26 @@ export CFLAGS="${FLAGS}" export CXXFLAGS="${FLAGS}" # Dependency version numbers -VERSION_ZLIB=1.2.10 +VERSION_ZLIB=1.2.11 VERSION_FFI=3.2.1 -VERSION_GLIB=2.50.1 +VERSION_GLIB=2.52.0 VERSION_XML2=2.9.4 -VERSION_GSF=1.14.40 +VERSION_GSF=1.14.41 VERSION_EXIF=0.6.21 VERSION_LCMS2=2.8 VERSION_JPEG=1.5.1 VERSION_PNG16=1.6.28 -VERSION_WEBP=0.5.1 -VERSION_TIFF=4.0.6 +VERSION_WEBP=0.6.0 +VERSION_TIFF=4.0.7 VERSION_ORC=0.4.26 -VERSION_GDKPIXBUF=2.36.0 -VERSION_FREETYPE=2.7 +VERSION_GDKPIXBUF=2.36.6 +VERSION_FREETYPE=2.7.1 +VERSION_EXPAT=2.2.0 VERSION_FONTCONFIG=2.12.1 -VERSION_HARFBUZZ=1.3.2 +VERSION_HARFBUZZ=1.4.5 VERSION_PIXMAN=0.34.0 -VERSION_CAIRO=1.14.6 -VERSION_PANGO=1.40.3 +VERSION_CAIRO=1.14.8 +VERSION_PANGO=1.40.4 VERSION_CROCO=0.6.11 VERSION_SVG=2.40.16 VERSION_GIF=5.1.4 @@ -56,11 +57,12 @@ cd ${DEPS}/ffi make install-strip mkdir ${DEPS}/glib -curl -Ls https://download.gnome.org/sources/glib/2.50/glib-${VERSION_GLIB}.tar.xz | tar xJC ${DEPS}/glib --strip-components=1 +curl -Ls https://download.gnome.org/sources/glib/2.52/glib-${VERSION_GLIB}.tar.xz | tar xJC ${DEPS}/glib --strip-components=1 cd ${DEPS}/glib echo glib_cv_stack_grows=no >>glib.cache echo glib_cv_uscore=no >>glib.cache -./configure --cache-file=glib.cache --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --with-pcre=internal --disable-libmount +./configure --cache-file=glib.cache --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking \ + --with-pcre=internal --disable-libmount make install-strip mkdir ${DEPS}/xml2 @@ -87,6 +89,9 @@ make install-strip mkdir ${DEPS}/lcms2 curl -Ls http://${SOURCEFORGE_MIRROR}.dl.sourceforge.net/project/lcms/lcms/${VERSION_LCMS2}/lcms2-${VERSION_LCMS2}.tar.gz | tar xzC ${DEPS}/lcms2 --strip-components=1 cd ${DEPS}/lcms2 +# Apply patches for lcms2 vulnerabilities reported since v2.8 +VERSION_LCMS2_GIT_MASTER_SHA=$(curl -Ls https://api.github.com/repos/mm2/Little-CMS/git/refs/heads/master | jq -r '.object.sha' | head -c7) +curl -Ls https://github.com/mm2/Little-CMS/compare/lcms2.8...master.patch | patch -p1 -t || true ./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking make install-strip @@ -106,15 +111,16 @@ make install-strip mkdir ${DEPS}/webp curl -Ls http://downloads.webmproject.org/releases/webp/libwebp-${VERSION_WEBP}.tar.gz | tar xzC ${DEPS}/webp --strip-components=1 cd ${DEPS}/webp -./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --disable-neon +./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking \ + --disable-neon --enable-libwebpmux make install-strip mkdir ${DEPS}/tiff curl -Ls http://download.osgeo.org/libtiff/tiff-${VERSION_TIFF}.tar.gz | tar xzC ${DEPS}/tiff --strip-components=1 cd ${DEPS}/tiff -# Apply patches for various libtiff security vulnerabilities reported since v4.0.6 +# Apply patches for libtiff vulnerabilities reported since v4.0.7 VERSION_TIFF_GIT_MASTER_SHA=$(curl -Ls https://api.github.com/repos/vadz/libtiff/git/refs/heads/master | jq -r '.object.sha' | head -c7) -curl -Ls https://github.com/vadz/libtiff/compare/Release-v4-0-6...master.patch | patch -p1 -t || true +curl -Ls https://github.com/vadz/libtiff/compare/Release-v4-0-7...master.patch | patch -p1 -t || true if [ -n "${CHOST}" ]; then autoreconf -fiv; fi ./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --disable-mdi --disable-pixarlog --disable-cxx make install-strip @@ -130,8 +136,11 @@ rm -rf liborc-test-* mkdir ${DEPS}/gdkpixbuf curl -Ls https://download.gnome.org/sources/gdk-pixbuf/2.36/gdk-pixbuf-${VERSION_GDKPIXBUF}.tar.xz | tar xJC ${DEPS}/gdkpixbuf --strip-components=1 cd ${DEPS}/gdkpixbuf +touch gdk-pixbuf/loaders.cache LD_LIBRARY_PATH=${TARGET}/lib \ -./configure --cache-file=gdkpixbuf.cache --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --disable-introspection --disable-modules --disable-gio-sniffing --without-libtiff --without-gdiplus --with-included-loaders=png,jpeg +./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking \ + --disable-introspection --disable-modules --disable-gio-sniffing \ + --without-libtiff --without-gdiplus --with-included-loaders=png,jpeg make install-strip mkdir ${DEPS}/freetype @@ -140,10 +149,17 @@ cd ${DEPS}/freetype ./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static make install +mkdir ${DEPS}/expat +curl -Ls http://${SOURCEFORGE_MIRROR}.dl.sourceforge.net/project/expat/expat/${VERSION_EXPAT}/expat-${VERSION_EXPAT}.tar.bz2 | tar xjC ${DEPS}/expat --strip-components=1 +cd ${DEPS}/expat +./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static +make install + mkdir ${DEPS}/fontconfig curl -Ls https://www.freedesktop.org/software/fontconfig/release/fontconfig-${VERSION_FONTCONFIG}.tar.bz2 | tar xjC ${DEPS}/fontconfig --strip-components=1 cd ${DEPS}/fontconfig -./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --enable-libxml2 --sysconfdir=/etc +./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking \ + --with-expat-includes=${TARGET}/include --with-expat-lib=${TARGET}/lib --sysconfdir=/etc make install-strip mkdir ${DEPS}/harfbuzz @@ -191,7 +207,7 @@ cd ${DEPS}/gif make install-strip mkdir ${DEPS}/vips -curl -Ls http://www.vips.ecs.soton.ac.uk/supported/8.4/vips-${VERSION_VIPS}.tar.gz | tar xzC ${DEPS}/vips --strip-components=1 +curl -Ls https://github.com/jcupitt/libvips/releases/download/v${VERSION_VIPS}/vips-${VERSION_VIPS}.tar.gz | tar xzC ${DEPS}/vips --strip-components=1 cd ${DEPS}/vips ./configure --host=${CHOST} --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking \ --disable-debug --disable-introspection --without-python --without-fftw \ @@ -212,6 +228,7 @@ echo "{\n\ \"cairo\": \"${VERSION_CAIRO}\",\n\ \"croco\": \"${VERSION_CROCO}\",\n\ \"exif\": \"${VERSION_EXIF}\",\n\ + \"expat\": \"${VERSION_EXPAT}\",\n\ \"ffi\": \"${VERSION_FFI}\",\n\ \"fontconfig\": \"${VERSION_FONTCONFIG}\",\n\ \"freetype\": \"${VERSION_FREETYPE}\",\n\ @@ -221,7 +238,7 @@ echo "{\n\ \"gsf\": \"${VERSION_GSF}\",\n\ \"harfbuzz\": \"${VERSION_HARFBUZZ}\",\n\ \"jpeg\": \"${VERSION_JPEG}\",\n\ - \"lcms\": \"${VERSION_LCMS2}\",\n\ + \"lcms\": \"${VERSION_LCMS2}-${VERSION_LCMS2_GIT_MASTER_SHA}\",\n\ \"orc\": \"${VERSION_ORC}\",\n\ \"pango\": \"${VERSION_PANGO}\",\n\ \"pixman\": \"${VERSION_PIXMAN}\",\n\ diff --git a/packaging/build/win.sh b/packaging/build/win.sh index 2b095f1f..31c33e48 100755 --- a/packaging/build/win.sh +++ b/packaging/build/win.sh @@ -8,14 +8,11 @@ curl -L -O https://github.com/lovell/build-win64/releases/download/v${VERSION_VI unzip vips-dev-w64-web-${VERSION_VIPS}.zip # Clean and zip -cd /vips/vips-dev-8.4 +cd /vips/vips-dev-8.5 rm bin/libvipsCC-42.dll bin/libvips-cpp-42.dll bin/libgsf-win32-1-114.dll cp bin/*.dll lib/ cp -r lib64/* lib/ -# Temp patch for __declspec ordering -curl -L -o include/vips/VImage8.h https://raw.githubusercontent.com/lovell/libvips/e1aef0445bf123d2de000bc7f2ef97b9f788eea0/cplusplus/include/vips/VImage8.h - echo "Creating tarball" tar czf /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz include lib/glib-2.0 lib/libvips.lib lib/libglib-2.0.lib lib/libgobject-2.0.lib lib/*.dll echo "Shrinking tarball" diff --git a/packaging/linux-armv8/Dockerfile b/packaging/linux-armv8/Dockerfile index 357ee690..41029ac2 100644 --- a/packaging/linux-armv8/Dockerfile +++ b/packaging/linux-armv8/Dockerfile @@ -9,7 +9,7 @@ RUN \ apt-get install -y curl && \ dpkg --add-architecture arm64 && \ apt-get update && \ - apt-get install -y crossbuild-essential-arm64 autoconf libtool nasm gtk-doc-tools texinfo advancecomp libglib2.0-dev jq + apt-get install -y crossbuild-essential-arm64 autoconf libtool nasm gtk-doc-tools texinfo advancecomp libglib2.0-dev jq gettext intltool autopoint # Compiler settings ENV \ diff --git a/packaging/test-linux-x64.sh b/packaging/test-linux-x64.sh index e9f49d89..3d073695 100755 --- a/packaging/test-linux-x64.sh +++ b/packaging/test-linux-x64.sh @@ -6,15 +6,14 @@ if ! type docker >/dev/null; then exit 1 fi -version_node=6.3.0 - test="npm run clean; npm install --unsafe-perm; npm test" # Debian 7, 8 -# Ubuntu 14.04 -for dist in wheezy jessie trusty; do +# Ubuntu 14.04, 16.04 +for dist in debian:jessie debian:stretch ubuntu:trusty ubuntu:xenial; do echo "Testing $dist..." - if docker run -i -t --rm -v $PWD:/v -e "NODE_ENV=development" nodesource/$dist:$version_node >packaging/$dist.log 2>&1 sh -c "cd /v; ./packaging/test/debian.sh; $test"; + docker pull $dist + if docker run -i -t --rm -v $PWD:/v $dist >packaging/$dist.log 2>&1 sh -c "cd /v; ./packaging/test/debian.sh; $test"; then echo "$dist OK" else echo "$dist fail" && cat packaging/$dist.log fi @@ -22,35 +21,16 @@ done # Centos 7 echo "Testing centos7..." -if docker run -i -t --rm -v $PWD:/v -e "NODE_ENV=development" nodesource/centos7:$version_node >packaging/$dist.log 2>&1 sh -c "cd /v; $test"; +docker pull centos:7 +if docker run -i -t --rm -v $PWD:/v centos:7 >packaging/centos7.log 2>&1 sh -c "cd /v; ./packaging/test/centos.sh; $test"; then echo "centos7 OK" -else echo "centos7 fail" && cat packaging/$dist.log +else echo "centos7 fail" && cat packaging/centos7.log fi -# Fedora 22 -echo "Testing fedora22..." -if docker run -i -t --rm -v $PWD:/v -e "NODE_ENV=development" nodesource/fedora22:$version_node >packaging/$dist.log 2>&1 sh -c "cd /v; $test"; -then echo "fedora22 OK" -else echo "fedora22 fail" && cat packaging/$dist.log -fi - -# openSUSE 13.2 -echo "Testing opensuse..." -if docker run -i -t --rm -v $PWD:/v opensuse:13.2 >packaging/opensuse.log 2>&1 /bin/sh -c "cd /v; ./packaging/test/opensuse.sh; $test"; -then echo "opensuse OK" -else echo "opensuse fail" && cat packaging/opensuse.log -fi - -# Archlinux 2015.06.01 +# Archlinux latest echo "Testing archlinux..." +docker pull pritunl/archlinux:latest if docker run -i -t --rm -v $PWD:/v pritunl/archlinux:latest >packaging/archlinux.log 2>&1 sh -c "cd /v; ./packaging/test/archlinux.sh; $test"; then echo "archlinux OK" else echo "archlinux fail" && cat packaging/archlinux.log fi - -# Alpine -echo "Testing alpine..." -if docker run -i -t --rm -v $PWD:/v -e "SHARP_TEST_WITHOUT_CACHE=0" alpine:edge >packaging/alpine.log 2>&1 sh -c "cd /v; ./packaging/test/alpine.sh; $test"; -then echo "alpine OK" -else echo "alpine fail" && cat packaging/alpine.log -fi diff --git a/packaging/test/alpine.sh b/packaging/test/alpine.sh deleted file mode 100755 index 00fcb472..00000000 --- a/packaging/test/alpine.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Install build dependencies -apk add --update make gcc g++ python nodejs - -# Install libvips from aports/testing -apk add --update --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing vips-dev diff --git a/packaging/test/centos.sh b/packaging/test/centos.sh new file mode 100755 index 00000000..5a3d63fa --- /dev/null +++ b/packaging/test/centos.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +curl -sL https://rpm.nodesource.com/setup_6.x | bash - +yum install -y gcc-c++ make nodejs diff --git a/packaging/test/debian.sh b/packaging/test/debian.sh index 578e5006..5c6f9ef9 100755 --- a/packaging/test/debian.sh +++ b/packaging/test/debian.sh @@ -1,5 +1,6 @@ #!/bin/sh -# Install pkg-config on Debian/Ubuntu apt-get update -apt-get install -y pkg-config +apt-get install -y build-essential python pkg-config curl +curl -sL https://deb.nodesource.com/setup_6.x | bash - +apt-get install -y nodejs diff --git a/packaging/test/opensuse.sh b/packaging/test/opensuse.sh deleted file mode 100755 index fa9c8e8a..00000000 --- a/packaging/test/opensuse.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Install Node.js on openSUSE 13.2 -zypper addrepo http://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_13.2/devel:languages:nodejs.repo -zypper --gpg-auto-import-keys refresh -zypper --non-interactive install gcc-c++ make nodejs-devel npm -npm install -g npm diff --git a/packaging/win32-x64/Dockerfile b/packaging/win32-x64/Dockerfile index a6d44aff..4c4abade 100644 --- a/packaging/win32-x64/Dockerfile +++ b/packaging/win32-x64/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:jessie +FROM debian:stretch MAINTAINER Lovell Fuller # Create Debian-based container suitable for post-processing Windows x64 binaries diff --git a/src/libvips/cplusplus/VImage.cpp b/src/libvips/cplusplus/VImage.cpp index d9b55133..27b29fdf 100644 --- a/src/libvips/cplusplus/VImage.cpp +++ b/src/libvips/cplusplus/VImage.cpp @@ -350,7 +350,7 @@ set_property( VipsObject *object, const char *name, const GValue *value ) if( vips_object_get_argument( object, name, &pspec, &argument_class, &argument_instance ) ) { - vips_warn( NULL, "%s", vips_error_buffer() ); + g_warning( "%s", vips_error_buffer() ); vips_error_clear(); return; } @@ -364,7 +364,7 @@ set_property( VipsObject *object, const char *name, const GValue *value ) if( (enum_value = vips_enum_from_nick( object_class->nickname, pspec_type, g_value_get_string( value ) )) < 0 ) { - vips_warn( NULL, "%s", vips_error_buffer() ); + g_warning( "%s", vips_error_buffer() ); vips_error_clear(); return; } @@ -770,19 +770,19 @@ operator+( VImage a, std::vector b ) } VImage & -operator+=( VImage a, const VImage b ) +operator+=( VImage &a, const VImage b ) { return( a = a + b ); } VImage & -operator+=( VImage a, const double b ) +operator+=( VImage &a, const double b ) { return( a = a + b ); } VImage & -operator+=( VImage a, std::vector b ) +operator+=( VImage &a, std::vector b ) { return( a = a + b ); } @@ -818,19 +818,19 @@ operator-( VImage a, std::vector b ) } VImage & -operator-=( VImage a, const VImage b ) +operator-=( VImage &a, const VImage b ) { return( a = a - b ); } VImage & -operator-=( VImage a, const double b ) +operator-=( VImage &a, const double b ) { return( a = a - b ); } VImage & -operator-=( VImage a, std::vector b ) +operator-=( VImage &a, std::vector b ) { return( a = a - b ); } @@ -872,19 +872,19 @@ operator*( VImage a, std::vector b ) } VImage & -operator*=( VImage a, const VImage b ) +operator*=( VImage &a, const VImage b ) { return( a = a * b ); } VImage & -operator*=( VImage a, const double b ) +operator*=( VImage &a, const double b ) { return( a = a * b ); } VImage & -operator*=( VImage a, std::vector b ) +operator*=( VImage &a, std::vector b ) { return( a = a * b ); } @@ -920,19 +920,19 @@ operator/( VImage a, std::vector b ) } VImage & -operator/=( VImage a, const VImage b ) +operator/=( VImage &a, const VImage b ) { return( a = a / b ); } VImage & -operator/=( VImage a, const double b ) +operator/=( VImage &a, const double b ) { return( a = a / b ); } VImage & -operator/=( VImage a, std::vector b ) +operator/=( VImage &a, std::vector b ) { return( a = a / b ); } @@ -956,19 +956,19 @@ operator%( VImage a, std::vector b ) } VImage & -operator%=( VImage a, const VImage b ) +operator%=( VImage &a, const VImage b ) { return( a = a % b ); } VImage & -operator%=( VImage a, const double b ) +operator%=( VImage &a, const double b ) { return( a = a % b ); } VImage & -operator%=( VImage a, std::vector b ) +operator%=( VImage &a, std::vector b ) { return( a = a % b ); } @@ -982,29 +982,29 @@ operator<( VImage a, VImage b ) VImage operator<( double a, VImage b ) { - return( b.relational_const( to_vector( a ), - VIPS_OPERATION_RELATIONAL_MORE ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_MORE, + to_vector( a ) ) ); } VImage operator<( VImage a, double b ) { - return( a.relational_const( to_vector( b ), - VIPS_OPERATION_RELATIONAL_LESS ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_LESS, + to_vector( b ) ) ); } VImage operator<( std::vector a, VImage b ) { - return( b.relational_const( a, - VIPS_OPERATION_RELATIONAL_MORE ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_MORE, + a ) ); } VImage operator<( VImage a, std::vector b ) { - return( a.relational_const( b, - VIPS_OPERATION_RELATIONAL_LESS ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_LESS, + b ) ); } VImage @@ -1016,29 +1016,29 @@ operator<=( VImage a, VImage b ) VImage operator<=( double a, VImage b ) { - return( b.relational_const( to_vector( a ), - VIPS_OPERATION_RELATIONAL_MOREEQ ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_MOREEQ, + to_vector( a ) ) ); } VImage operator<=( VImage a, double b ) { - return( a.relational_const( to_vector( b ), - VIPS_OPERATION_RELATIONAL_LESSEQ ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_LESSEQ, + to_vector( b ) ) ); } VImage operator<=( std::vector a, VImage b ) { - return( b.relational_const( a, - VIPS_OPERATION_RELATIONAL_MOREEQ ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_MOREEQ, + a ) ); } VImage operator<=( VImage a, std::vector b ) { - return( a.relational_const( b, - VIPS_OPERATION_RELATIONAL_LESSEQ ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_LESSEQ, + b ) ); } VImage @@ -1050,29 +1050,29 @@ operator>( VImage a, VImage b ) VImage operator>( double a, VImage b ) { - return( b.relational_const( to_vector( a ), - VIPS_OPERATION_RELATIONAL_LESS ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_LESS, + to_vector( a ) ) ); } VImage operator>( VImage a, double b ) { - return( a.relational_const( to_vector( b ), - VIPS_OPERATION_RELATIONAL_MORE ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_MORE, + to_vector( b ) ) ); } VImage operator>( std::vector a, VImage b ) { - return( b.relational_const( a, - VIPS_OPERATION_RELATIONAL_LESS ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_LESS, + a ) ); } VImage operator>( VImage a, std::vector b ) { - return( a.relational_const( b, - VIPS_OPERATION_RELATIONAL_MORE ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_MORE, + b ) ); } VImage @@ -1084,29 +1084,29 @@ operator>=( VImage a, VImage b ) VImage operator>=( double a, VImage b ) { - return( b.relational_const( to_vector( a ), - VIPS_OPERATION_RELATIONAL_LESSEQ ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_LESSEQ, + to_vector( a ) ) ); } VImage operator>=( VImage a, double b ) { - return( a.relational_const( to_vector( b ), - VIPS_OPERATION_RELATIONAL_MOREEQ ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_MOREEQ, + to_vector( b ) ) ); } VImage operator>=( std::vector a, VImage b ) { - return( b.relational_const( a, - VIPS_OPERATION_RELATIONAL_LESSEQ ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_LESSEQ, + a ) ); } VImage operator>=( VImage a, std::vector b ) { - return( a.relational_const( b, - VIPS_OPERATION_RELATIONAL_MOREEQ ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_MOREEQ, + b ) ); } VImage @@ -1118,29 +1118,29 @@ operator==( VImage a, VImage b ) VImage operator==( double a, VImage b ) { - return( b.relational_const( to_vector( a ), - VIPS_OPERATION_RELATIONAL_EQUAL ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_EQUAL, + to_vector( a ) ) ); } VImage operator==( VImage a, double b ) { - return( a.relational_const( to_vector( b ), - VIPS_OPERATION_RELATIONAL_EQUAL ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_EQUAL, + to_vector( b ) ) ); } VImage operator==( std::vector a, VImage b ) { - return( b.relational_const( a, - VIPS_OPERATION_RELATIONAL_EQUAL ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_EQUAL, + a ) ); } VImage operator==( VImage a, std::vector b ) { - return( a.relational_const( b, - VIPS_OPERATION_RELATIONAL_EQUAL ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_EQUAL, + b ) ); } VImage @@ -1152,29 +1152,29 @@ operator!=( VImage a, VImage b ) VImage operator!=( double a, VImage b ) { - return( b.relational_const( to_vector( a ), - VIPS_OPERATION_RELATIONAL_NOTEQ ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_NOTEQ, + to_vector( a ) ) ); } VImage operator!=( VImage a, double b ) { - return( a.relational_const( to_vector( b ), - VIPS_OPERATION_RELATIONAL_NOTEQ ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_NOTEQ, + to_vector( b ) ) ); } VImage operator!=( std::vector a, VImage b ) { - return( b.relational_const( a, - VIPS_OPERATION_RELATIONAL_NOTEQ ) ); + return( b.relational_const( VIPS_OPERATION_RELATIONAL_NOTEQ, + a ) ); } VImage operator!=( VImage a, std::vector b ) { - return( a.relational_const( b, - VIPS_OPERATION_RELATIONAL_NOTEQ ) ); + return( a.relational_const( VIPS_OPERATION_RELATIONAL_NOTEQ, + b ) ); } VImage @@ -1186,43 +1186,43 @@ operator&( VImage a, VImage b ) VImage operator&( double a, VImage b ) { - return( b.boolean_const( to_vector( a ), - VIPS_OPERATION_BOOLEAN_AND ) ); + return( b.boolean_const( VIPS_OPERATION_BOOLEAN_AND, + to_vector( a ) ) ); } VImage operator&( VImage a, double b ) { - return( a.boolean_const( to_vector( b ), - VIPS_OPERATION_BOOLEAN_AND ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_AND, + to_vector( b ) ) ); } VImage operator&( std::vector a, VImage b ) { - return( b.boolean_const( a, VIPS_OPERATION_BOOLEAN_AND ) ); + return( b.boolean_const( VIPS_OPERATION_BOOLEAN_AND, a ) ); } VImage operator&( VImage a, std::vector b ) { - return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_AND ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_AND, b ) ); } VImage & -operator&=( VImage a, const VImage b ) +operator&=( VImage &a, const VImage b ) { return( a = a & b ); } VImage & -operator&=( VImage a, const double b ) +operator&=( VImage &a, const double b ) { return( a = a & b ); } VImage & -operator&=( VImage a, std::vector b ) +operator&=( VImage &a, std::vector b ) { return( a = a & b ); } @@ -1236,43 +1236,45 @@ operator|( VImage a, VImage b ) VImage operator|( double a, VImage b ) { - return( b.boolean_const( to_vector( a ), - VIPS_OPERATION_BOOLEAN_OR ) ); + return( b.boolean_const( VIPS_OPERATION_BOOLEAN_OR, + to_vector( a ) ) ); } VImage operator|( VImage a, double b ) { - return( a.boolean_const( to_vector( b ), - VIPS_OPERATION_BOOLEAN_OR ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_OR, + to_vector( b ) ) ); } VImage operator|( std::vector a, VImage b ) { - return( b.boolean_const( a, VIPS_OPERATION_BOOLEAN_OR ) ); + return( b.boolean_const( VIPS_OPERATION_BOOLEAN_OR, + a ) ); } VImage operator|( VImage a, std::vector b ) { - return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_OR ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_OR, + b ) ); } VImage & -operator|=( VImage a, const VImage b ) +operator|=( VImage &a, const VImage b ) { return( a = a | b ); } VImage & -operator|=( VImage a, const double b ) +operator|=( VImage &a, const double b ) { return( a = a | b ); } VImage & -operator|=( VImage a, std::vector b ) +operator|=( VImage &a, std::vector b ) { return( a = a | b ); } @@ -1286,43 +1288,45 @@ operator^( VImage a, VImage b ) VImage operator^( double a, VImage b ) { - return( b.boolean_const( to_vector( a ), - VIPS_OPERATION_BOOLEAN_EOR ) ); + return( b.boolean_const( VIPS_OPERATION_BOOLEAN_EOR, + to_vector( a ) ) ); } VImage operator^( VImage a, double b ) { - return( a.boolean_const( to_vector( b ), - VIPS_OPERATION_BOOLEAN_EOR ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_EOR, + to_vector( b ) ) ); } VImage operator^( std::vector a, VImage b ) { - return( b.boolean_const( a, VIPS_OPERATION_BOOLEAN_EOR ) ); + return( b.boolean_const( VIPS_OPERATION_BOOLEAN_EOR, + a ) ); } VImage operator^( VImage a, std::vector b ) { - return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_EOR ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_EOR, + b ) ); } VImage & -operator^=( VImage a, const VImage b ) +operator^=( VImage &a, const VImage b ) { return( a = a ^ b ); } VImage & -operator^=( VImage a, const double b ) +operator^=( VImage &a, const double b ) { return( a = a ^ b ); } VImage & -operator^=( VImage a, std::vector b ) +operator^=( VImage &a, std::vector b ) { return( a = a ^ b ); } @@ -1336,30 +1340,31 @@ operator<<( VImage a, VImage b ) VImage operator<<( VImage a, double b ) { - return( a.boolean_const( to_vector( b ), - VIPS_OPERATION_BOOLEAN_LSHIFT ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_LSHIFT, + to_vector( b ) ) ); } VImage operator<<( VImage a, std::vector b ) { - return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_LSHIFT ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_LSHIFT, + b ) ); } VImage & -operator<<=( VImage a, const VImage b ) +operator<<=( VImage &a, const VImage b ) { return( a = a << b ); } VImage & -operator<<=( VImage a, const double b ) +operator<<=( VImage &a, const double b ) { return( a = a << b ); } VImage & -operator<<=( VImage a, std::vector b ) +operator<<=( VImage &a, std::vector b ) { return( a = a << b ); } @@ -1373,30 +1378,31 @@ operator>>( VImage a, VImage b ) VImage operator>>( VImage a, double b ) { - return( a.boolean_const( to_vector( b ), - VIPS_OPERATION_BOOLEAN_RSHIFT ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_RSHIFT, + to_vector( b ) ) ); } VImage operator>>( VImage a, std::vector b ) { - return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_RSHIFT ) ); + return( a.boolean_const( VIPS_OPERATION_BOOLEAN_RSHIFT, + b ) ); } VImage & -operator>>=( VImage a, const VImage b ) +operator>>=( VImage &a, const VImage b ) { return( a = a << b ); } VImage & -operator>>=( VImage a, const double b ) +operator>>=( VImage &a, const double b ) { return( a = a << b ); } VImage & -operator>>=( VImage a, std::vector b ) +operator>>=( VImage &a, std::vector b ) { return( a = a << b ); } diff --git a/src/libvips/cplusplus/vips-operators.cpp b/src/libvips/cplusplus/vips-operators.cpp index 7a0721b2..bff2a745 100644 --- a/src/libvips/cplusplus/vips-operators.cpp +++ b/src/libvips/cplusplus/vips-operators.cpp @@ -1,5 +1,5 @@ // bodies for vips operations -// Thu 18 Aug 16:01:57 BST 2016 +// Mon 13 Mar 13:22:17 GMT 2017 // this file is generated automatically, do not edit! void VImage::system( char * cmd_format , VOption *options ) @@ -231,7 +231,7 @@ VImage VImage::round( VipsOperationRound round , VOption *options ) return( out ); } -VImage VImage::relational_const( std::vector c , VipsOperationRelational relational , VOption *options ) +VImage VImage::relational_const( VipsOperationRelational relational , std::vector c , VOption *options ) { VImage out; @@ -239,8 +239,8 @@ VImage VImage::relational_const( std::vector c , VipsOperationRelational (options ? options : VImage::option()) -> set( "in", *this ) -> set( "out", &out ) -> - set( "c", c ) -> - set( "relational", relational ) ); + set( "relational", relational ) -> + set( "c", c ) ); return( out ); } @@ -258,7 +258,7 @@ VImage VImage::remainder_const( std::vector c , VOption *options ) return( out ); } -VImage VImage::boolean_const( std::vector c , VipsOperationBoolean boolean , VOption *options ) +VImage VImage::boolean_const( VipsOperationBoolean boolean , std::vector c , VOption *options ) { VImage out; @@ -266,13 +266,13 @@ VImage VImage::boolean_const( std::vector c , VipsOperationBoolean boole (options ? options : VImage::option()) -> set( "in", *this ) -> set( "out", &out ) -> - set( "c", c ) -> - set( "boolean", boolean ) ); + set( "boolean", boolean ) -> + set( "c", c ) ); return( out ); } -VImage VImage::math2_const( std::vector c , VipsOperationMath2 math2 , VOption *options ) +VImage VImage::math2_const( VipsOperationMath2 math2 , std::vector c , VOption *options ) { VImage out; @@ -280,8 +280,8 @@ VImage VImage::math2_const( std::vector c , VipsOperationMath2 math2 , V (options ? options : VImage::option()) -> set( "in", *this ) -> set( "out", &out ) -> - set( "c", c ) -> - set( "math2", math2 ) ); + set( "math2", math2 ) -> + set( "c", c ) ); return( out ); } @@ -493,8 +493,8 @@ VImage VImage::copy( VOption *options ) call( "copy" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -505,8 +505,8 @@ VImage VImage::tilecache( VOption *options ) call( "tilecache" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -517,8 +517,8 @@ VImage VImage::linecache( VOption *options ) call( "linecache" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -529,8 +529,8 @@ VImage VImage::sequential( VOption *options ) call( "sequential" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -541,8 +541,8 @@ VImage VImage::cache( VOption *options ) call( "cache" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -569,8 +569,8 @@ VImage VImage::flip( VipsDirection direction , VOption *options ) call( "flip" , (options ? options : VImage::option()) -> - set( "out", &out ) -> set( "in", *this ) -> + set( "out", &out ) -> set( "direction", direction ) ); return( out ); @@ -633,6 +633,20 @@ VImage VImage::extract_area( int left , int top , int width , int height , VOpti return( out ); } +VImage VImage::smartcrop( int width , int height , VOption *options ) +{ + VImage out; + + call( "smartcrop" , + (options ? options : VImage::option()) -> + set( "input", *this ) -> + set( "out", &out ) -> + set( "width", width ) -> + set( "height", height ) ); + + return( out ); +} + VImage VImage::extract_band( int band , VOption *options ) { VImage out; @@ -728,8 +742,8 @@ VImage VImage::cast( VipsBandFormat format , VOption *options ) call( "cast" , (options ? options : VImage::option()) -> - set( "out", &out ) -> set( "in", *this ) -> + set( "out", &out ) -> set( "format", format ) ); return( out ); @@ -741,8 +755,8 @@ VImage VImage::rot( VipsAngle angle , VOption *options ) call( "rot" , (options ? options : VImage::option()) -> - set( "out", &out ) -> set( "in", *this ) -> + set( "out", &out ) -> set( "angle", angle ) ); return( out ); @@ -754,8 +768,8 @@ VImage VImage::rot45( VOption *options ) call( "rot45" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -766,8 +780,8 @@ VImage VImage::autorot( VOption *options ) call( "autorot" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -805,8 +819,8 @@ VImage VImage::bandfold( VOption *options ) call( "bandfold" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -817,8 +831,8 @@ VImage VImage::bandunfold( VOption *options ) call( "bandunfold" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -829,8 +843,8 @@ VImage VImage::flatten( VOption *options ) call( "flatten" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -841,8 +855,8 @@ VImage VImage::premultiply( VOption *options ) call( "premultiply" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -853,8 +867,8 @@ VImage VImage::unpremultiply( VOption *options ) call( "unpremultiply" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -865,8 +879,8 @@ VImage VImage::grid( int tile_height , int across , int down , VOption *options call( "grid" , (options ? options : VImage::option()) -> - set( "out", &out ) -> set( "in", *this ) -> + set( "out", &out ) -> set( "tile-height", tile_height ) -> set( "across", across ) -> set( "down", down ) ); @@ -880,8 +894,8 @@ VImage VImage::scale( VOption *options ) call( "scale" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -892,8 +906,8 @@ VImage VImage::wrap( VOption *options ) call( "wrap" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -944,8 +958,8 @@ VImage VImage::byteswap( VOption *options ) call( "byteswap" , (options ? options : VImage::option()) -> - set( "out", &out ) -> - set( "in", *this ) ); + set( "in", *this ) -> + set( "out", &out ) ); return( out ); } @@ -1757,6 +1771,18 @@ void VImage::dzsave( char * filename , VOption *options ) set( "filename", filename ) ); } +VipsBlob * VImage::dzsave_buffer( VOption *options ) +{ + VipsBlob * buffer; + + call( "dzsave_buffer" , + (options ? options : VImage::option()) -> + set( "in", *this ) -> + set( "buffer", &buffer ) ); + + return( buffer ); +} + void VImage::pngsave( char * filename , VOption *options ) { call( "pngsave" , @@ -1832,6 +1858,18 @@ void VImage::tiffsave( char * filename , VOption *options ) set( "filename", filename ) ); } +VipsBlob * VImage::tiffsave_buffer( VOption *options ) +{ + VipsBlob * buffer; + + call( "tiffsave_buffer" , + (options ? options : VImage::option()) -> + set( "in", *this ) -> + set( "buffer", &buffer ) ); + + return( buffer ); +} + void VImage::fitssave( char * filename , VOption *options ) { call( "fitssave" , @@ -1840,6 +1878,32 @@ void VImage::fitssave( char * filename , VOption *options ) set( "filename", filename ) ); } +VImage VImage::thumbnail( char * filename , int width , VOption *options ) +{ + VImage out; + + call( "thumbnail" , + (options ? options : VImage::option()) -> + set( "filename", filename ) -> + set( "out", &out ) -> + set( "width", width ) ); + + return( out ); +} + +VImage VImage::thumbnail_buffer( VipsBlob * buffer , int width , VOption *options ) +{ + VImage out; + + call( "thumbnail_buffer" , + (options ? options : VImage::option()) -> + set( "buffer", buffer ) -> + set( "out", &out ) -> + set( "width", width ) ); + + return( out ); +} + VImage VImage::mapim( VImage index , VOption *options ) { VImage out; diff --git a/test/fixtures/expected/embed-2channel.png b/test/fixtures/expected/embed-2channel.png index a15d715d..dbf3bda0 100644 Binary files a/test/fixtures/expected/embed-2channel.png and b/test/fixtures/expected/embed-2channel.png differ diff --git a/test/fixtures/expected/gamma-0.0.jpg b/test/fixtures/expected/gamma-0.0.jpg index 30c123c6..01dba1c1 100644 Binary files a/test/fixtures/expected/gamma-0.0.jpg and b/test/fixtures/expected/gamma-0.0.jpg differ