mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Upgrade libvips to v8.4.2
Improved EXIF orientation and GIF alpha channel support
This commit is contained in:
parent
1051fcd278
commit
eb30f6ceff
@ -41,7 +41,6 @@ Any change that modifies the existing public API should be added to the relevant
|
||||
|
||||
| Release | WIP branch |
|
||||
| ------: | :--------- |
|
||||
| v0.16.0 | pencil |
|
||||
| v0.17.0 | quill |
|
||||
| v0.18.0 | ridge |
|
||||
|
||||
@ -90,4 +89,9 @@ npm run test-packaging
|
||||
|
||||
## Finally
|
||||
|
||||
Please feel free to ask any questions via a [new issue](https://github.com/lovell/sharp/issues/new) or contact me by [e-mail](https://github.com/lovell/sharp/blob/master/package.json#L4).
|
||||
Please feel free to ask any questions via a
|
||||
[new issue](https://github.com/lovell/sharp/issues/new).
|
||||
|
||||
If you're unable to post details publicly, please
|
||||
[e-mail](https://github.com/lovell/sharp/blob/master/package.json#L4)
|
||||
for private, paid consulting.
|
||||
|
@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
### v0.17 - "*quill*"
|
||||
|
||||
Requires libvips v8.4.2
|
||||
|
||||
#### v0.17.0 - TBD
|
||||
|
||||
* Ensure support for embedded base64 PNG and JPEG images within an SVG.
|
||||
[#601](https://github.com/lovell/sharp/issues/601)
|
||||
[@dynamite-ready](https://github.com/dynamite-ready)
|
||||
|
||||
### v0.16 - "*pencil*"
|
||||
|
||||
Requires libvips v8.3.3
|
||||
|
4
package.json
Normal file → Executable file
4
package.json
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sharp",
|
||||
"version": "0.16.2",
|
||||
"version": "0.17.0",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"contributors": [
|
||||
"Pierre Inglebert <pierre.inglebert@gmail.com>",
|
||||
@ -81,7 +81,7 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"config": {
|
||||
"libvips": "8.3.3"
|
||||
"libvips": "8.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
|
@ -18,23 +18,23 @@ export CXXFLAGS="${FLAGS}"
|
||||
# Dependency version numbers
|
||||
VERSION_ZLIB=1.2.8
|
||||
VERSION_FFI=3.2.1
|
||||
VERSION_GLIB=2.49.4
|
||||
VERSION_GLIB=2.50.1
|
||||
VERSION_XML2=2.9.4
|
||||
VERSION_GSF=1.14.39
|
||||
VERSION_GSF=1.14.40
|
||||
VERSION_EXIF=0.6.21
|
||||
VERSION_LCMS2=2.8
|
||||
VERSION_JPEG=1.5.0
|
||||
VERSION_JPEG=1.5.1
|
||||
VERSION_PNG16=1.6.25
|
||||
VERSION_WEBP=0.5.1
|
||||
VERSION_TIFF=4.0.6
|
||||
VERSION_ORC=0.4.25
|
||||
VERSION_GDKPIXBUF=2.35.2
|
||||
VERSION_FREETYPE=2.6.5
|
||||
VERSION_FONTCONFIG=2.12.0
|
||||
VERSION_HARFBUZZ=1.3.0
|
||||
VERSION_ORC=0.4.26
|
||||
VERSION_GDKPIXBUF=2.36.0
|
||||
VERSION_FREETYPE=2.7
|
||||
VERSION_FONTCONFIG=2.12.1
|
||||
VERSION_HARFBUZZ=1.3.2
|
||||
VERSION_PIXMAN=0.34.0
|
||||
VERSION_CAIRO=1.14.6
|
||||
VERSION_PANGO=1.40.1
|
||||
VERSION_PANGO=1.40.3
|
||||
VERSION_CROCO=0.6.11
|
||||
VERSION_SVG=2.40.16
|
||||
VERSION_GIF=5.1.4
|
||||
@ -56,11 +56,11 @@ cd ${DEPS}/ffi
|
||||
make install-strip
|
||||
|
||||
mkdir ${DEPS}/glib
|
||||
curl -Ls https://download.gnome.org/sources/glib/2.49/glib-${VERSION_GLIB}.tar.xz | tar xJC ${DEPS}/glib --strip-components=1
|
||||
curl -Ls https://download.gnome.org/sources/glib/2.50/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
|
||||
./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
|
||||
@ -125,10 +125,10 @@ cd ${TARGET}/lib
|
||||
rm -rf liborc-test-*
|
||||
|
||||
mkdir ${DEPS}/gdkpixbuf
|
||||
curl -Ls https://download.gnome.org/sources/gdk-pixbuf/2.35/gdk-pixbuf-${VERSION_GDKPIXBUF}.tar.xz | tar xJC ${DEPS}/gdkpixbuf --strip-components=1
|
||||
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
|
||||
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-libpng --without-libjpeg --without-libtiff --without-gdiplus --with-included-loaders=
|
||||
./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
|
||||
make install-strip
|
||||
|
||||
mkdir ${DEPS}/freetype
|
||||
@ -188,7 +188,7 @@ cd ${DEPS}/gif
|
||||
make install-strip
|
||||
|
||||
mkdir ${DEPS}/vips
|
||||
curl -Ls http://www.vips.ecs.soton.ac.uk/supported/8.3/vips-${VERSION_VIPS}.tar.gz | tar xzC ${DEPS}/vips --strip-components=1
|
||||
curl -Ls http://www.vips.ecs.soton.ac.uk/supported/8.4/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 \
|
||||
|
@ -8,11 +8,14 @@ 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.3
|
||||
cd /vips/vips-dev-8.4
|
||||
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"
|
||||
|
@ -15,4 +15,4 @@ RUN \
|
||||
ENV \
|
||||
PLATFORM=linux-armv8 \
|
||||
CHOST=aarch64-linux-gnu \
|
||||
FLAGS="-march=armv8-a -Os -D_GLIBCXX_USE_CXX11_ABI=0"
|
||||
FLAGS="-march=armv8-a -Os"
|
||||
|
@ -263,11 +263,8 @@ namespace sharp {
|
||||
*/
|
||||
int ExifOrientation(VImage image) {
|
||||
int orientation = 0;
|
||||
if (image.get_typeof(EXIF_IFD0_ORIENTATION) != 0) {
|
||||
char const *exif = image.get_string(EXIF_IFD0_ORIENTATION);
|
||||
if (exif != nullptr) {
|
||||
orientation = atoi(&exif[0]);
|
||||
}
|
||||
if (image.get_typeof(VIPS_META_ORIENTATION) != 0) {
|
||||
orientation = image.get_int(VIPS_META_ORIENTATION);
|
||||
}
|
||||
return orientation;
|
||||
}
|
||||
@ -276,16 +273,14 @@ namespace sharp {
|
||||
Set EXIF Orientation of image.
|
||||
*/
|
||||
void SetExifOrientation(VImage image, int const orientation) {
|
||||
char exif[3];
|
||||
g_snprintf(exif, sizeof(exif), "%d", orientation);
|
||||
image.set(EXIF_IFD0_ORIENTATION, exif);
|
||||
image.set(VIPS_META_ORIENTATION, orientation);
|
||||
}
|
||||
|
||||
/*
|
||||
Remove EXIF Orientation from image.
|
||||
*/
|
||||
void RemoveExifOrientation(VImage image) {
|
||||
SetExifOrientation(image, 0);
|
||||
vips_image_remove(image.get_image(), VIPS_META_ORIENTATION);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
// Verify platform and compiler compatibility
|
||||
|
||||
#if (VIPS_MAJOR_VERSION < 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 3))
|
||||
#error libvips version 8.3.x required - see sharp.dimens.io/page/install
|
||||
#if (VIPS_MAJOR_VERSION < 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 4))
|
||||
#error libvips version 8.4.x required - see sharp.dimens.io/page/install
|
||||
#endif
|
||||
|
||||
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
||||
@ -25,8 +25,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define EXIF_IFD0_ORIENTATION "exif-ifd0-Orientation"
|
||||
|
||||
using vips::VImage;
|
||||
|
||||
namespace sharp {
|
||||
|
@ -2,6 +2,10 @@
|
||||
*
|
||||
* 30/12/14
|
||||
* - allow set enum value from string
|
||||
* 10/6/16
|
||||
* - missing implementation of VImage::write()
|
||||
* 11/6/16
|
||||
* - added arithmetic assignment overloads, += etc.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -457,7 +461,7 @@ VImage::call_option_string( const char *operation_name,
|
||||
{
|
||||
VipsOperation *operation;
|
||||
|
||||
VIPS_DEBUG_MSG( "vips_call_by_name: starting for %s ...\n",
|
||||
VIPS_DEBUG_MSG( "call_option_string: starting for %s ...\n",
|
||||
operation_name );
|
||||
|
||||
if( !(operation = vips_operation_new( operation_name )) ) {
|
||||
@ -485,6 +489,7 @@ VImage::call_option_string( const char *operation_name,
|
||||
*/
|
||||
if( vips_cache_operation_buildp( &operation ) ) {
|
||||
vips_object_unref_outputs( VIPS_OBJECT( operation ) );
|
||||
g_object_unref( operation );
|
||||
delete options;
|
||||
throw( VError() );
|
||||
}
|
||||
@ -566,7 +571,7 @@ VImage::new_from_image( std::vector<double> pixel )
|
||||
VImage onepx = VImage::black( 1, 1,
|
||||
VImage::option()->set( "bands", bands() ) );
|
||||
|
||||
onepx = onepx.linear( to_vectorv( 1, 1.0 ), pixel ).cast( format() );
|
||||
onepx = (onepx + pixel).cast( format() );
|
||||
|
||||
VImage big = onepx.embed( 0, 0, width(), height(),
|
||||
VImage::option()->set( "extend", VIPS_EXTEND_COPY ) );
|
||||
@ -612,6 +617,15 @@ VImage::new_matrixv( int width, int height, ... )
|
||||
return( matrix );
|
||||
}
|
||||
|
||||
VImage
|
||||
VImage::write( VImage out )
|
||||
{
|
||||
if( vips_image_write( this->get_image(), out.get_image() ) )
|
||||
throw VError();
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
void
|
||||
VImage::write_to_file( const char *name, VOption *options )
|
||||
{
|
||||
@ -755,13 +769,32 @@ operator+( VImage a, std::vector<double> b )
|
||||
return( a.linear( 1.0, b ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator+=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a + b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator+=( VImage a, const double b )
|
||||
{
|
||||
return( a = a + b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator+=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a + b );
|
||||
}
|
||||
|
||||
VImage
|
||||
operator-( VImage a, VImage b )
|
||||
{
|
||||
return( a.subtract( b ) );
|
||||
}
|
||||
|
||||
VImage operator-( double a, VImage b )
|
||||
VImage
|
||||
operator-( double a, VImage b )
|
||||
{
|
||||
return( b.linear( -1.0, a ) );
|
||||
}
|
||||
@ -784,6 +817,24 @@ operator-( VImage a, std::vector<double> b )
|
||||
return( a.linear( 1.0, vips::negate( b ) ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator-=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a - b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator-=( VImage a, const double b )
|
||||
{
|
||||
return( a = a - b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator-=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a - b );
|
||||
}
|
||||
|
||||
VImage
|
||||
operator-( VImage a )
|
||||
{
|
||||
@ -820,6 +871,24 @@ operator*( VImage a, std::vector<double> b )
|
||||
return( a.linear( b, 0.0 ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator*=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a * b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator*=( VImage a, const double b )
|
||||
{
|
||||
return( a = a * b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator*=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a * b );
|
||||
}
|
||||
|
||||
VImage
|
||||
operator/( VImage a, VImage b )
|
||||
{
|
||||
@ -850,6 +919,24 @@ operator/( VImage a, std::vector<double> b )
|
||||
return( a.linear( vips::invert( b ), 0.0 ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator/=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a / b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator/=( VImage a, const double b )
|
||||
{
|
||||
return( a = a / b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator/=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a / b );
|
||||
}
|
||||
|
||||
VImage
|
||||
operator%( VImage a, VImage b )
|
||||
{
|
||||
@ -868,6 +955,24 @@ operator%( VImage a, std::vector<double> b )
|
||||
return( a.remainder_const( b ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator%=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a % b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator%=( VImage a, const double b )
|
||||
{
|
||||
return( a = a % b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator%=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a % b );
|
||||
}
|
||||
|
||||
VImage
|
||||
operator<( VImage a, VImage b )
|
||||
{
|
||||
@ -1104,6 +1209,24 @@ operator&( VImage a, std::vector<double> b )
|
||||
return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_AND ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator&=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a & b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator&=( VImage a, const double b )
|
||||
{
|
||||
return( a = a & b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator&=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a & b );
|
||||
}
|
||||
|
||||
VImage
|
||||
operator|( VImage a, VImage b )
|
||||
{
|
||||
@ -1136,6 +1259,24 @@ operator|( VImage a, std::vector<double> b )
|
||||
return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_OR ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator|=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a | b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator|=( VImage a, const double b )
|
||||
{
|
||||
return( a = a | b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator|=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a | b );
|
||||
}
|
||||
|
||||
VImage
|
||||
operator^( VImage a, VImage b )
|
||||
{
|
||||
@ -1168,6 +1309,24 @@ operator^( VImage a, std::vector<double> b )
|
||||
return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_EOR ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator^=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a ^ b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator^=( VImage a, const double b )
|
||||
{
|
||||
return( a = a ^ b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator^=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a ^ b );
|
||||
}
|
||||
|
||||
VImage
|
||||
operator<<( VImage a, VImage b )
|
||||
{
|
||||
@ -1187,6 +1346,24 @@ operator<<( VImage a, std::vector<double> b )
|
||||
return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_LSHIFT ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator<<=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a << b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator<<=( VImage a, const double b )
|
||||
{
|
||||
return( a = a << b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator<<=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a << b );
|
||||
}
|
||||
|
||||
VImage
|
||||
operator>>( VImage a, VImage b )
|
||||
{
|
||||
@ -1206,4 +1383,22 @@ operator>>( VImage a, std::vector<double> b )
|
||||
return( a.boolean_const( b, VIPS_OPERATION_BOOLEAN_RSHIFT ) );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator>>=( VImage a, const VImage b )
|
||||
{
|
||||
return( a = a << b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator>>=( VImage a, const double b )
|
||||
{
|
||||
return( a = a << b );
|
||||
}
|
||||
|
||||
VImage &
|
||||
operator>>=( VImage a, std::vector<double> b )
|
||||
{
|
||||
return( a = a << b );
|
||||
}
|
||||
|
||||
VIPS_NAMESPACE_END
|
||||
|
@ -1,5 +1,5 @@
|
||||
// bodies for vips operations
|
||||
// Fri Feb 12 20:03:53 GMT 2016
|
||||
// Thu 18 Aug 16:01:57 BST 2016
|
||||
// this file is generated automatically, do not edit!
|
||||
|
||||
void VImage::system( char * cmd_format , VOption *options )
|
||||
@ -1321,26 +1321,28 @@ VImage VImage::fractsurf( int width , int height , double fractal_dimension , VO
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::radload( char * filename , VOption *options )
|
||||
VImage VImage::worley( int width , int height , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "radload" ,
|
||||
call( "worley" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "filename", filename ) ->
|
||||
set( "out", &out ) );
|
||||
set( "out", &out ) ->
|
||||
set( "width", width ) ->
|
||||
set( "height", height ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::ppmload( char * filename , VOption *options )
|
||||
VImage VImage::perlin( int width , int height , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "ppmload" ,
|
||||
call( "perlin" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "filename", filename ) ->
|
||||
set( "out", &out ) );
|
||||
set( "out", &out ) ->
|
||||
set( "width", width ) ->
|
||||
set( "height", height ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
@ -1369,18 +1371,6 @@ VImage VImage::matrixload( char * filename , VOption *options )
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::analyzeload( char * filename , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "analyzeload" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "filename", filename ) ->
|
||||
set( "out", &out ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::rawload( char * filename , int width , int height , int bands , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
@ -1408,6 +1398,42 @@ VImage VImage::vipsload( char * filename , VOption *options )
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::analyzeload( char * filename , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "analyzeload" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "filename", filename ) ->
|
||||
set( "out", &out ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::ppmload( char * filename , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "ppmload" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "filename", filename ) ->
|
||||
set( "out", &out ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::radload( char * filename , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "radload" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "filename", filename ) ->
|
||||
set( "out", &out ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::pdfload( char * filename , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
@ -1648,22 +1674,6 @@ VImage VImage::openexrload( char * filename , VOption *options )
|
||||
return( out );
|
||||
}
|
||||
|
||||
void VImage::radsave( char * filename , VOption *options )
|
||||
{
|
||||
call( "radsave" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "filename", filename ) );
|
||||
}
|
||||
|
||||
void VImage::ppmsave( char * filename , VOption *options )
|
||||
{
|
||||
call( "ppmsave" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "filename", filename ) );
|
||||
}
|
||||
|
||||
void VImage::csvsave( char * filename , VOption *options )
|
||||
{
|
||||
call( "csvsave" ,
|
||||
@ -1711,6 +1721,34 @@ void VImage::vipssave( char * filename , VOption *options )
|
||||
set( "filename", filename ) );
|
||||
}
|
||||
|
||||
void VImage::ppmsave( char * filename , VOption *options )
|
||||
{
|
||||
call( "ppmsave" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "filename", filename ) );
|
||||
}
|
||||
|
||||
void VImage::radsave( char * filename , VOption *options )
|
||||
{
|
||||
call( "radsave" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "filename", filename ) );
|
||||
}
|
||||
|
||||
VipsBlob * VImage::radsave_buffer( VOption *options )
|
||||
{
|
||||
VipsBlob * buffer;
|
||||
|
||||
call( "radsave_buffer" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "buffer", &buffer ) );
|
||||
|
||||
return( buffer );
|
||||
}
|
||||
|
||||
void VImage::dzsave( char * filename , VOption *options )
|
||||
{
|
||||
call( "dzsave" ,
|
||||
@ -1815,7 +1853,7 @@ VImage VImage::mapim( VImage index , VOption *options )
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::shrink( double xshrink , double yshrink , VOption *options )
|
||||
VImage VImage::shrink( double hshrink , double vshrink , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
@ -1823,13 +1861,13 @@ VImage VImage::shrink( double xshrink , double yshrink , VOption *options )
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "xshrink", xshrink ) ->
|
||||
set( "yshrink", yshrink ) );
|
||||
set( "hshrink", hshrink ) ->
|
||||
set( "vshrink", vshrink ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::shrinkh( int xshrink , VOption *options )
|
||||
VImage VImage::shrinkh( int hshrink , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
@ -1837,12 +1875,12 @@ VImage VImage::shrinkh( int xshrink , VOption *options )
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "xshrink", xshrink ) );
|
||||
set( "hshrink", hshrink ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::shrinkv( int yshrink , VOption *options )
|
||||
VImage VImage::shrinkv( int vshrink , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
@ -1850,12 +1888,12 @@ VImage VImage::shrinkv( int yshrink , VOption *options )
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "yshrink", yshrink ) );
|
||||
set( "vshrink", vshrink ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::reduceh( double xshrink , VOption *options )
|
||||
VImage VImage::reduceh( double hshrink , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
@ -1863,12 +1901,12 @@ VImage VImage::reduceh( double xshrink , VOption *options )
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "xshrink", xshrink ) );
|
||||
set( "hshrink", hshrink ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::reducev( double yshrink , VOption *options )
|
||||
VImage VImage::reducev( double vshrink , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
@ -1876,12 +1914,12 @@ VImage VImage::reducev( double yshrink , VOption *options )
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "yshrink", yshrink ) );
|
||||
set( "vshrink", vshrink ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::reduce( double xshrink , double yshrink , VOption *options )
|
||||
VImage VImage::reduce( double hshrink , double vshrink , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
@ -1889,8 +1927,8 @@ VImage VImage::reduce( double xshrink , double yshrink , VOption *options )
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "xshrink", xshrink ) ->
|
||||
set( "yshrink", yshrink ) );
|
||||
set( "hshrink", hshrink ) ->
|
||||
set( "vshrink", vshrink ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
@ -2475,6 +2513,45 @@ VImage VImage::conv( VImage mask , VOption *options )
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::conva( VImage mask , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "conva" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "mask", mask ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::convf( VImage mask , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "convf" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "mask", mask ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::convi( VImage mask , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "convi" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "mask", mask ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::compass( VImage mask , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
@ -2501,6 +2578,19 @@ VImage VImage::convsep( VImage mask , VOption *options )
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::convasep( VImage mask , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "convasep" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "mask", mask ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::fastcor( VImage ref , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
BIN
test/fixtures/CMU-1-Small-Region.svs
vendored
BIN
test/fixtures/CMU-1-Small-Region.svs
vendored
Binary file not shown.
BIN
test/fixtures/expected/svg-embedded.png
vendored
Normal file
BIN
test/fixtures/expected/svg-embedded.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 79 KiB |
3
test/fixtures/index.js
vendored
3
test/fixtures/index.js
vendored
@ -88,8 +88,7 @@ module.exports = {
|
||||
inputGif: getPath('Crash_test.gif'), // http://upload.wikimedia.org/wikipedia/commons/e/e3/Crash_test.gif
|
||||
inputGifGreyPlusAlpha: getPath('grey-plus-alpha.gif'), // http://i.imgur.com/gZ5jlmE.gif
|
||||
inputSvg: getPath('check.svg'), // http://dev.w3.org/SVG/tools/svgweb/samples/svg-files/check.svg
|
||||
|
||||
inputSvs: getPath('CMU-1-Small-Region.svs'), // http://openslide.cs.cmu.edu/download/openslide-testdata/Aperio/CMU-1-Small-Region.svs
|
||||
inputSvgWithEmbeddedImages: getPath('struct-image-04-t.svg'), // https://dev.w3.org/SVG/profiles/1.2T/test/svg/struct-image-04-t.svg
|
||||
|
||||
inputJPGBig: getPath('flowers.jpeg'),
|
||||
|
||||
|
42
test/fixtures/struct-image-04-t.svg
vendored
Normal file
42
test/fixtures/struct-image-04-t.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 32 KiB |
@ -277,6 +277,17 @@
|
||||
...
|
||||
fun:_ZN6icu_568Collator19getAvailableLocalesERi
|
||||
}
|
||||
{
|
||||
leak_nodejs_thread_start
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: possible
|
||||
fun:calloc
|
||||
fun:allocate_dtv
|
||||
fun:_dl_allocate_tls
|
||||
fun:allocate_stack
|
||||
...
|
||||
fun:_ZN2v84base6Thread5StartEv
|
||||
}
|
||||
{
|
||||
leak_nan_FunctionCallbackInfo
|
||||
Memcheck:Leak
|
||||
|
@ -668,48 +668,60 @@ describe('Input/output', function() {
|
||||
});
|
||||
});
|
||||
|
||||
if (sharp.format.svg.input.file) {
|
||||
it('Convert SVG to PNG at default 72DPI', function(done) {
|
||||
sharp(fixtures.inputSvg)
|
||||
.resize(1024)
|
||||
.extract({left: 290, top: 760, width: 40, height: 40})
|
||||
.toFormat('png')
|
||||
.toBuffer(function(err, data, info) {
|
||||
it('Convert SVG to PNG at default 72DPI', function(done) {
|
||||
sharp(fixtures.inputSvg)
|
||||
.resize(1024)
|
||||
.extract({left: 290, top: 760, width: 40, height: 40})
|
||||
.toFormat('png')
|
||||
.toBuffer(function(err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(40, info.width);
|
||||
assert.strictEqual(40, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('svg72.png'), data, function(err) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(40, info.width);
|
||||
assert.strictEqual(40, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('svg72.png'), data, function(err) {
|
||||
sharp(data).metadata(function(err, info) {
|
||||
if (err) throw err;
|
||||
sharp(data).metadata(function(err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(72, info.density);
|
||||
done();
|
||||
});
|
||||
assert.strictEqual(72, info.density);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
it('Convert SVG to PNG at 300DPI', function(done) {
|
||||
sharp(fixtures.inputSvg, { density: 1200 })
|
||||
.resize(1024)
|
||||
.extract({left: 290, top: 760, width: 40, height: 40})
|
||||
.toFormat('png')
|
||||
.toBuffer(function(err, data, info) {
|
||||
});
|
||||
});
|
||||
|
||||
it('Convert SVG to PNG at 300DPI', function(done) {
|
||||
sharp(fixtures.inputSvg, { density: 1200 })
|
||||
.resize(1024)
|
||||
.extract({left: 290, top: 760, width: 40, height: 40})
|
||||
.toFormat('png')
|
||||
.toBuffer(function(err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(40, info.width);
|
||||
assert.strictEqual(40, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('svg1200.png'), data, function(err) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(40, info.width);
|
||||
assert.strictEqual(40, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('svg1200.png'), data, function(err) {
|
||||
sharp(data).metadata(function(err, info) {
|
||||
if (err) throw err;
|
||||
sharp(data).metadata(function(err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(1200, info.density);
|
||||
done();
|
||||
});
|
||||
assert.strictEqual(1200, info.density);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Convert SVG with embedded images to PNG, respecting dimensions', function(done) {
|
||||
sharp(fixtures.inputSvgWithEmbeddedImages)
|
||||
.png()
|
||||
.toBuffer(function(err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(480, info.width);
|
||||
assert.strictEqual(360, info.height);
|
||||
assert.strictEqual(4, info.channels);
|
||||
fixtures.assertSimilar(fixtures.expected('svg-embedded.png'), data, done);
|
||||
});
|
||||
});
|
||||
|
||||
if (sharp.format.tiff.input.buffer) {
|
||||
it('Load TIFF from Buffer', function(done) {
|
||||
@ -765,22 +777,6 @@ describe('Input/output', function() {
|
||||
});
|
||||
}
|
||||
|
||||
if (sharp.format.openslide.input.file) {
|
||||
it('Load Aperio SVS file via Openslide', function(done) {
|
||||
sharp(fixtures.inputSvs)
|
||||
.resize(320, 240)
|
||||
.jpeg()
|
||||
.toBuffer(function(err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
done();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (sharp.format.v.input.file) {
|
||||
it("Load Vips V file", function(done) {
|
||||
sharp(fixtures.inputV)
|
||||
|
@ -69,7 +69,7 @@ describe('Image metadata', function() {
|
||||
assert.strictEqual(300, metadata.density);
|
||||
assert.strictEqual(false, metadata.hasProfile);
|
||||
assert.strictEqual(false, metadata.hasAlpha);
|
||||
assert.strictEqual('undefined', typeof metadata.orientation);
|
||||
assert.strictEqual(1, metadata.orientation);
|
||||
assert.strictEqual('undefined', typeof metadata.exif);
|
||||
assert.strictEqual('undefined', typeof metadata.icc);
|
||||
done();
|
||||
@ -140,10 +140,10 @@ describe('Image metadata', function() {
|
||||
assert.strictEqual('gif', metadata.format);
|
||||
assert.strictEqual(800, metadata.width);
|
||||
assert.strictEqual(533, metadata.height);
|
||||
assert.strictEqual(4, metadata.channels);
|
||||
assert.strictEqual(3, metadata.channels);
|
||||
assert.strictEqual('undefined', typeof metadata.density);
|
||||
assert.strictEqual(false, metadata.hasProfile);
|
||||
assert.strictEqual(true, metadata.hasAlpha);
|
||||
assert.strictEqual(false, metadata.hasAlpha);
|
||||
assert.strictEqual('undefined', typeof metadata.orientation);
|
||||
assert.strictEqual('undefined', typeof metadata.exif);
|
||||
assert.strictEqual('undefined', typeof metadata.icc);
|
||||
@ -156,7 +156,7 @@ describe('Image metadata', function() {
|
||||
assert.strictEqual('gif', metadata.format);
|
||||
assert.strictEqual(2, metadata.width);
|
||||
assert.strictEqual(1, metadata.height);
|
||||
assert.strictEqual(4, metadata.channels);
|
||||
assert.strictEqual(2, metadata.channels);
|
||||
assert.strictEqual('undefined', typeof metadata.density);
|
||||
assert.strictEqual(false, metadata.hasProfile);
|
||||
assert.strictEqual(true, metadata.hasAlpha);
|
||||
|
@ -127,7 +127,7 @@ describe('Rotation', function() {
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
sharp(data).metadata(function(err, metadata) {
|
||||
assert.strictEqual(false, 'orientation' in metadata);
|
||||
assert.strictEqual(1, metadata.orientation);
|
||||
fixtures.assertSimilar(fixtures.expected('exif-5.jpg'), data, done);
|
||||
});
|
||||
});
|
||||
@ -177,7 +177,7 @@ describe('Rotation', function() {
|
||||
assert.strictEqual(261, info.height);
|
||||
sharp(data).metadata(function(err, metadata) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(false, 'orientation' in metadata);
|
||||
assert.strictEqual(1, metadata.orientation);
|
||||
fixtures.assertSimilar(fixtures.expected('flip.jpg'), data, done);
|
||||
});
|
||||
});
|
||||
@ -195,7 +195,7 @@ describe('Rotation', function() {
|
||||
assert.strictEqual(261, info.height);
|
||||
sharp(data).metadata(function(err, metadata) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(false, 'orientation' in metadata);
|
||||
assert.strictEqual(1, metadata.orientation);
|
||||
fixtures.assertSimilar(fixtures.expected('flop.jpg'), data, done);
|
||||
});
|
||||
});
|
||||
|
@ -144,10 +144,10 @@ describe('Tile', function() {
|
||||
if (sharp.format.dz.output.file) {
|
||||
|
||||
it('Deep Zoom layout', function(done) {
|
||||
var directory = fixtures.path('output.dz_files');
|
||||
var directory = fixtures.path('output.dzi_files');
|
||||
rimraf(directory, function() {
|
||||
sharp(fixtures.inputJpg)
|
||||
.toFile(fixtures.path('output.dz.dzi'), function(err, info) {
|
||||
.toFile(fixtures.path('output.dzi'), function(err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('dz', info.format);
|
||||
assertDeepZoomTiles(directory, 256, 13, done);
|
||||
@ -156,14 +156,14 @@ describe('Tile', function() {
|
||||
});
|
||||
|
||||
it('Deep Zoom layout with custom size+overlap', function(done) {
|
||||
var directory = fixtures.path('output.dz.512_files');
|
||||
var directory = fixtures.path('output.512.dzi_files');
|
||||
rimraf(directory, function() {
|
||||
sharp(fixtures.inputJpg)
|
||||
.tile({
|
||||
size: 512,
|
||||
overlap: 16
|
||||
})
|
||||
.toFile(fixtures.path('output.dz.512.dzi'), function(err, info) {
|
||||
.toFile(fixtures.path('output.512.dzi'), function(err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('dz', info.format);
|
||||
assertDeepZoomTiles(directory, 512 + 2 * 16, 13, done);
|
||||
@ -172,7 +172,7 @@ describe('Tile', function() {
|
||||
});
|
||||
|
||||
it('Zoomify layout', function(done) {
|
||||
var directory = fixtures.path('output.zoomify');
|
||||
var directory = fixtures.path('output.zoomify.dzi');
|
||||
rimraf(directory, function() {
|
||||
sharp(fixtures.inputJpg)
|
||||
.tile({
|
||||
@ -192,13 +192,13 @@ describe('Tile', function() {
|
||||
});
|
||||
|
||||
it('Google layout', function(done) {
|
||||
var directory = fixtures.path('output.google');
|
||||
var directory = fixtures.path('output.google.dzi');
|
||||
rimraf(directory, function() {
|
||||
sharp(fixtures.inputJpg)
|
||||
.tile({
|
||||
layout: 'google'
|
||||
})
|
||||
.toFile(fixtures.path('output.google.dzi'), function(err, info) {
|
||||
.toFile(directory, function(err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('dz', info.format);
|
||||
fs.stat(path.join(directory, '0', '0', '0.jpg'), function(err, stat) {
|
||||
@ -244,7 +244,7 @@ describe('Tile', function() {
|
||||
.tile({
|
||||
container: 'zip'
|
||||
})
|
||||
.toFile(fixtures.path('output.dz.containeropt.dzi'), function(err, info) {
|
||||
.toFile(container, function(err, info) {
|
||||
// Vips overrides .dzi extension to .zip used by container var below
|
||||
if (err) throw err;
|
||||
assert.strictEqual('dz', info.format);
|
||||
|
Loading…
x
Reference in New Issue
Block a user