Merge branch 'master' into add-mapimage

This commit is contained in:
John Cupitt 2019-08-11 17:30:10 +01:00
commit 10af2c2ddb
69 changed files with 81722 additions and 19738 deletions

View File

@ -8,6 +8,7 @@ before_script:
--disable-dependency-tracking
--with-jpeg-includes=$JPEG/include
--with-jpeg-libraries=$JPEG/lib
--with-magick=$WITH_MAGICK
- make -j$JOBS -s
script:
- make -j$JOBS -s -k V=0 VERBOSE=1 check
@ -30,6 +31,7 @@ matrix:
- PYVIPS_VERSION=master
- JPEG=/usr
- JOBS=`nproc`
- WITH_MAGICK=yes
cache: ccache
- os: linux
@ -41,11 +43,16 @@ matrix:
- PYVIPS_VERSION=master
- JPEG=/usr
- JOBS=`nproc`
- CFLAGS="-fsanitize=address -fno-omit-frame-pointer -fopenmp"
- LDFLAGS="-fsanitize=address -dynamic-asan -fopenmp=libiomp5"
- WITH_MAGICK=no
- CFLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -fopenmp -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
- LDFLAGS="-fsanitize=address,undefined -dynamic-asan -fopenmp=libiomp5"
- ASAN_DSO=/usr/local/clang-7.0.0/lib/clang/7.0.0/lib/linux/libclang_rt.asan-x86_64.so
- LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/lsan.supp"
- FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1
- LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/suppressions/lsan.supp"
- UBSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/suppressions/ubsan.supp"
# comment these out, I get strange parse errors from asan for some
# reason
#
# ASAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/suppressions/asan.supp"
install:
# add support for WebP
- wget http://archive.ubuntu.com/ubuntu/pool/main/libw/libwebp/libwebp-dev_0.6.1-2_amd64.deb
@ -62,6 +69,7 @@ matrix:
- PYVIPS_VERSION=master
- JPEG=/usr/local
- JOBS="`sysctl -n hw.ncpu`"
- WITH_MAGICK=yes
- PATH="/usr/local/opt/ccache/libexec:$PATH"
- HOMEBREW_NO_AUTO_UPDATE=1
cache: ccache
@ -70,7 +78,7 @@ addons:
apt:
update: true
sources:
# use imagemagick 6.9.7-4 instead than 6.8.9-9
# use a more recent imagemagick instead of 6.8.9-9
- sourceline: 'ppa:opencpu/imagemagick'
# add support for HEIF files
- sourceline: 'ppa:strukturag/libheif'

View File

@ -13,6 +13,11 @@
- better early shutdown in readers
- don't attempt to save large XMP to jpeg [tnextday]
- always fetch HEIC metadata from the main image [zhoux2016]
- fix loop in malformed ppm [Kyle-Kyle]
- better support for PNGs with long comment names
- fix build with GM
- add locks for pdfium load
- fix build with MSVC
24/5/19 started 8.8.1
- improve realpath() use on older libc

View File

@ -449,7 +449,6 @@ AC_CHECK_FUNCS([getcwd gettimeofday getwd memset munmap putenv realpath strcasec
AC_CHECK_LIB(m,cbrt,[AC_DEFINE(HAVE_CBRT,1,[have cbrt() in libm.])])
AC_CHECK_LIB(m,hypot,[AC_DEFINE(HAVE_HYPOT,1,[have hypot() in libm.])])
AC_CHECK_LIB(m,atan2,[AC_DEFINE(HAVE_ATAN2,1,[have atan2() in libm.])])
AC_CHECK_LIB([pthread], [pthread_setattr_default_np], [AC_DEFINE(HAVE_PTHREAD_DEFAULT_NP,1,[have pthread_setattr_default_np() in pthread.])])
# have to have these
# need glib 2.6 for GOption
@ -486,6 +485,10 @@ PKG_CHECK_MODULES(MONOTONIC, glib-2.0 >= 2.28,
]
)
# the old threading system
PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
PACKAGES_USED="$PACKAGES_USED gthread-2.0"
# from 2.32 there are a new set of thread functions, annoyingly
PKG_CHECK_MODULES(THREADS, glib-2.0 >= 2.32,
[AC_DEFINE(HAVE_MUTEX_INIT,1,[define if your glib has g_mutex_init().])
@ -495,13 +498,23 @@ PKG_CHECK_MODULES(THREADS, glib-2.0 >= 2.32,
AC_DEFINE(HAVE_VALUE_GET_SCHAR,1,
[define if your glib has g_value_get_schar().]
)
],
[# the old threading system ... we need to link against gthread
PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
PACKAGES_USED="$PACKAGES_USED gthread-2.0"
]
)
# if available, we use pthread_setattr_default_np() to raise the per-thread
# stack size ... musl (libc on Alpine), for example, has a very small stack per
# thread by default
save_pthread_LIBS="$LIBS"
save_pthread_CFLAGS="$CFLAGS"
LIBS="$LIBS $GTHREAD_LIBS"
CFLAGS="$CFLAGS $GTHREAD_CFLAGS"
AC_CHECK_FUNC(pthread_setattr_default_np,
[AC_DEFINE(HAVE_PTHREAD_DEFAULT_NP,1,[have pthread_setattr_default_np().])
]
)
LIBS="$save_pthread_LIBS"
CFLAGS="$save_pthread_CFLAGS"
# from 2.36 the type system inits itself
PKG_CHECK_MODULES(TYPE_INIT, glib-2.0 < 2.36,
[AC_DEFINE(HAVE_TYPE_INIT,1,[define if your glib needs g_type_init().])
@ -662,68 +675,6 @@ else
with_magickpackage=none
fi
if test x"$magick6" = x"yes"; then
# we SetImageOption to disable some DICOM read processing, but that's only
# in more recent imagemagicks and not in graphicsmagick
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"
fi
if test x"$magick6" = x"yes"; then
# newer ImageMagicks use MagickCoreGenesis instead of InitializeMagick argh
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"
fi
if test x"$magick6" = x"yes"; then
# newer ImageMagicks use ResetImagePropertyIterator instead of
# ResetImageAttributeIterator argh
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"
fi
if test x"$magick6" = x"yes"; then
# so ... do we have ResetImageAttributeIterator()? GM does not
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"
fi
if test x"$magick6" = x"yes"; then
# GM does not have ResetImageProfileIterator
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(ResetImageProfileIterator,
AC_DEFINE(HAVE_RESETIMAGEPROFILEITERATOR,1,
[define if your magick has ResetImageProfileIterator.]))
LIBS="$save_LIBS"
fi
if test x"$magick6" = x"yes"; then
# more recent magicks have GetVirtualPixels rather than GetImagePixels
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"
fi
if test x"$magick6" = x"yes"; then
# do we have number_scenes in image_info ... imagemagick uses this
save_CFLAGS="$CFLAGS"
@ -737,63 +688,41 @@ if test x"$magick6" = x"yes"; then
fi
if test x"$magick6" = x"yes"; then
# more recent magick6s have AcquireImage rather than AllocateImage argh
# the magick6 API varies a lot between magick versions, and between GM and
# IM
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(AcquireImage,
AC_DEFINE(HAVE_ACQUIREIMAGE,1,
[define if your magick has AcquireImage.]))
AC_CHECK_FUNCS([InheritException AcquireExceptionInfo SetImageProperty SetImageExtent AcquireImage GetVirtualPixels ResetImageProfileIterator ResetImageAttributeIterator ResetImagePropertyIterator MagickCoreGenesis SetImageOption BlobToStringInfo OptimizePlusImageLayers OptimizeImageTransparency])
LIBS="$save_LIBS"
fi
if test x"$magick6" = x"yes"; then
# more recent magick6s have SetImageExtent
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(SetImageExtent,
AC_DEFINE(HAVE_SETIMAGEEXTENT,1,
[define if your magick has SetImageExtent.]))
LIBS="$save_LIBS"
fi
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $MAGICK_CFLAGS"
if test x"$magick6" = x"yes"; then
# GM uses SetImageAttribute(), IM uses SetImageProperty()
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(SetImageProperty,
AC_DEFINE(HAVE_SETIMAGEPROPERTY,1,
[define if your magick has SetImageProperty.]))
LIBS="$save_LIBS"
fi
# the range of ColorspaceType has expanded several times
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <magick/api.h>],
[ColorspaceType colorspace = CMYColorspace]
)],
[AC_DEFINE(HAVE_CMYCOLORSPACE,1,
[define if your Magick has CMYColorspace.])
]
)
if test x"$magick6" = x"yes"; then
# IM uses SetImageProfile() with StringInfo
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(BlobToStringInfo,
AC_DEFINE(HAVE_BLOBTOSTRINGINFO,1,
[define if your magick has BlobToStringInfo().]))
LIBS="$save_LIBS"
fi
# GetImageMagick() takes two args under GM, three under IM
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <magick/api.h>],
[(void)GetImageMagick(NULL, 0, NULL)]
)],
[AC_DEFINE(HAVE_GETIMAGEMAGICK3,1,
[define if your GetImageMagick() takes three arguments.])
]
)
if test x"$magick6" = x"yes"; then
# GM is missing InheritException
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(InheritException,
AC_DEFINE(HAVE_INHERITEXCEPTION,1,
[define if your magick has InheritException.]))
LIBS="$save_LIBS"
fi
if test x"$magick6" = x"yes"; then
# GM is missing AcquireExceptionInfo
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(AcquireExceptionInfo,
AC_DEFINE(HAVE_ACQUIREEXCEPTIONINFO,1,
[define if your magick has AcquireExceptionInfo.]))
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# have flags to turn load and save off independently ... some people will want

View File

@ -1,12 +1,8 @@
/*
* compile with:
/* compile with:
*
* g++ -g -Wall resize.cpp `pkg-config vips-cpp --cflags --libs`
*
*/
#define DEBUG
#include <vips/vips8>
using namespace vips;
@ -14,16 +10,15 @@ using namespace vips;
int
main( int argc, char **argv )
{
if( vips_init( argv[0] ) )
if( VIPS_INIT( argv[0] ) )
vips_error_exit( NULL );
VImage in = VImage::new_from_file( argv[1],
VImage::option()->set( "access", VIPS_ACCESS_SEQUENTIAL ) );
VInterpolate interp = VInterpolate::new_from_name( "nohalo" );
VImage in = VImage::new_from_file( argv[1], VImage::option()
->set( "access", "sequential" ) );
VImage out;
out = in.resize( 0.2, VImage::option()->set( "interpolate", interp ) );
VImage out = in.resize( 0.2, VImage::option()
->set( "kernel", "cubic" )
->set( "vscale", 0.2 ) );
out.write_to_file( argv[2] );

View File

@ -11,10 +11,18 @@ extern "C" int
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
{
VipsImage *image;
size_t len;
void *buf;
size_t len;
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) ) {
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) )
return( 0 );
/* Skip big images. They are likely to timeout.
*/
if( image->Xsize > 1024 ||
image->Ysize > 1024 ||
image->Bands > 10 ) {
g_object_unref( image );
return( 0 );
}

Binary file not shown.

View File

@ -14,7 +14,15 @@ LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
void *buf;
size_t len;
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) ) {
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) )
return( 0 );
/* Skip big images. They are likely to timeout.
*/
if( image->Xsize > 1024 ||
image->Ysize > 1024 ||
image->Bands > 10 ) {
g_object_unref( image );
return( 0 );
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

View File

@ -10,22 +10,30 @@ LLVMFuzzerInitialize( int *argc, char ***argv )
extern "C" int
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
{
VipsImage *in, *out;
VipsImage *image, *out;
double d;
if( !(in = vips_image_new_from_buffer( data, size, "", NULL )) ) {
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) )
return( 0 );
/* Skip big images. They are likely to timeout.
*/
if( image->Xsize > 1024 ||
image->Ysize > 1024 ||
image->Bands > 10 ) {
g_object_unref( image );
return( 0 );
}
if( vips_sharpen( in, &out, NULL ) ) {
g_object_unref( in );
if( vips_sharpen( image, &out, NULL ) ) {
g_object_unref( image );
return( 0 );
}
vips_avg( out, &d, NULL );
g_object_unref( out );
g_object_unref( in );
g_object_unref( image );
return( 0 );
}

View File

@ -6,6 +6,7 @@ set -e
# Glib is build without -fno-omit-frame-pointer. We need
# to disable the fast unwinder to get full stacktraces.
export ASAN_OPTIONS="fast_unwind_on_malloc=0:allocator_may_return_null=1"
export UBSAN_OPTIONS="print_stacktrace=1"
# Hide all warning messages from vips.
export VIPS_WARNING=0

View File

@ -10,33 +10,30 @@ LLVMFuzzerInitialize( int *argc, char ***argv )
extern "C" int
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
{
VipsImage *in, *out;
size_t width, height;
VipsImage *image, *out;
double d;
if( !(in = vips_image_new_from_buffer( data, size, "", NULL )) ) {
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) )
return( 0 );
}
width = in->Xsize;
height = in->Ysize;
/* Skip big images. It is likely to timeout.
/* Skip big images. They are likely to timeout.
*/
if ( width * height > 256 * 256 ) {
g_object_unref( in );
if( image->Xsize > 1024 ||
image->Ysize > 1024 ||
image->Bands > 10 ) {
g_object_unref( image );
return( 0 );
}
if( vips_thumbnail_image( in, &out, 42, NULL ) ) {
g_object_unref( in );
if( vips_thumbnail_image( image, &out, 42, NULL ) ) {
g_object_unref( image );
return( 0 );
}
vips_avg( out, &d, NULL );
g_object_unref( out );
g_object_unref( in );
g_object_unref( image );
return( 0 );
}

View File

@ -14,7 +14,15 @@ LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
void *buf;
size_t len;
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) ) {
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) )
return( 0 );
/* Skip big images. They are likely to timeout.
*/
if( image->Xsize > 1024 ||
image->Ysize > 1024 ||
image->Bands > 10 ) {
g_object_unref( image );
return( 0 );
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

View File

@ -73,6 +73,7 @@
#include <stdlib.h>
#include <vips/vips.h>
#include <vips/internal.h>
#include "binary.h"
#include "unaryconst.h"
@ -140,6 +141,15 @@ vips_boolean_build( VipsObject *object )
g_assert_not_reached(); \
}
#define FNLOOP( TYPE, FN ) { \
TYPE * restrict left = (TYPE *) in[0]; \
TYPE * restrict right = (TYPE *) in[1]; \
int * restrict q = (int *) out; \
\
for( x = 0; x < sz; x++ ) \
q[x] = FN( left[x], right[x] ); \
}
static void
vips_boolean_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
@ -163,8 +173,30 @@ vips_boolean_buffer( VipsArithmetic *arithmetic,
SWITCH( LOOP, FLOOP, ^ );
break;
/* Special case: we need to be able to use VIPS_LSHIFT_INT().
*/
case VIPS_OPERATION_BOOLEAN_LSHIFT:
SWITCH( LOOP, FLOOP, << );
switch( vips_image_get_format( im ) ) {
case VIPS_FORMAT_UCHAR:
LOOP( unsigned char, << ); break;
case VIPS_FORMAT_CHAR:
FNLOOP( signed char, VIPS_LSHIFT_INT ); break;
case VIPS_FORMAT_USHORT:
LOOP( unsigned short, << ); break;
case VIPS_FORMAT_SHORT:
FNLOOP( signed short, VIPS_LSHIFT_INT ); break;
case VIPS_FORMAT_UINT:
LOOP( unsigned int, << ); break;
case VIPS_FORMAT_INT:
FNLOOP( signed int, VIPS_LSHIFT_INT ); break;
case VIPS_FORMAT_FLOAT:
FLOOP( float, << ); break;
case VIPS_FORMAT_DOUBLE:
FLOOP( double, << ); break;
default:
g_assert_not_reached();
}
break;
case VIPS_OPERATION_BOOLEAN_RSHIFT:

View File

@ -268,6 +268,8 @@ vips_find_trim_init( VipsFindTrim *find_trim )
*
* @threshold defaults to 10.
*
* The image needs to be at least 3x3 pixels in size.
*
* See also: vips_getpoint(), vips_extract_area(), vips_smartcrop().
*
* Returns: 0 on success, -1 on error

View File

@ -55,6 +55,7 @@
#include <stdio.h>
#include <vips/vips.h>
#include <vips/internal.h>
#include "pcolour.h"
@ -95,12 +96,12 @@ vips_LabQ2Lab_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
/* Build a.
*/
l = (p[1] << 3) | ((lsbs >> 3) & 0x7);
l = VIPS_LSHIFT_INT( p[1], 3) | ((lsbs >> 3) & 0x7);
q[1] = (float) l * 0.125;
/* And b.
*/
l = (p[2] << 3) | (lsbs & 0x7);
l = VIPS_LSHIFT_INT( p[2], 3) | (lsbs & 0x7);
q[2] = (float) l * 0.125;
p += 4;

View File

@ -58,58 +58,19 @@ typedef VipsOperationClass VipsProfileLoadClass;
G_DEFINE_TYPE( VipsProfileLoad, vips_profile_load, VIPS_TYPE_OPERATION );
/* Created on first use from a base64 string in profiles.c.
*/
typedef struct _VipsFallbackProfile {
const char *name;
void *data;
size_t data_length;
} VipsFallbackProfile;
static GSList *vips_fallback_profile_list = NULL;
static void *
vips_fallback_profile_get_init( void )
static const void *
vips_profile_fallback_get( const char *name, size_t *length )
{
int i;
VipsProfileFallback *fallback;
for( i = 0; vips__coded_profiles[i].name; i++ ) {
size_t data_length;
unsigned char *data;
VipsFallbackProfile *fallback;
if( !(data = vips__b64_decode(
vips__coded_profiles[i].data, &data_length )) )
return( NULL );
fallback = g_new( VipsFallbackProfile,1 );
fallback->name = vips__coded_profiles[i].name;
fallback->data = data;
fallback->data_length = data_length;
vips_fallback_profile_list = g_slist_prepend(
vips_fallback_profile_list, fallback );
}
return( NULL );
}
static void *
vips_fallback_profile_get( const char *name, size_t *length )
{
static GOnce once = G_ONCE_INIT;
GSList *p;
VIPS_ONCE( &once, (GThreadFunc) vips_fallback_profile_get_init, NULL );
for( p = vips_fallback_profile_list; p; p = p->next ) {
VipsFallbackProfile *fallback = (VipsFallbackProfile *) p->data;
for( i = 0; (fallback = vips__profile_fallback_table[i]); i++ )
if( g_ascii_strcasecmp( fallback->name, name ) == 0 ) {
*length = fallback->data_length;
if( length )
*length = fallback->length;
return( fallback->data );
}
}
return( NULL );
}
@ -131,7 +92,7 @@ vips_profile_load_build( VipsObject *object )
if( g_ascii_strcasecmp( load->name, "none" ) == 0 ) {
profile = NULL;
}
else if( (data = vips_fallback_profile_get( load->name, &length )) ) {
else if( (data = vips_profile_fallback_get( load->name, &length )) ) {
profile = vips_blob_new( NULL, data, length );
}
else if( (data = vips__file_read_name( load->name,

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,13 @@
/* The fallback profiles, coded as a set of base64 strings, see
* wrap-profiles.sh
/* The fallback profiles, coded as a set of uchar arrays, see wrap-profiles.sh
*/
typedef struct _VipsCodedProfile {
#include <stddef.h>
typedef struct _VipsProfileFallback {
const char *name;
const char *data;
} VipsCodedProfile;
size_t length;
const unsigned char data[];
} VipsProfileFallback;
extern VipsCodedProfile vips__coded_profiles[];
extern VipsProfileFallback *vips__profile_fallback_table[];

View File

@ -1,22 +1,38 @@
#!/bin/bash
# code up the binary files in $1 as a set of name / base64-encoded strings
# code up the binary files in $1 as a set of name / string pairs
# in $2
# we have to use arrays for the strings, since MSVC won't allow string
# literals larger than 64kb
in=$1
out=$2
echo "/* coded files, generated automatically */" > $out
echo "/* this file generated automatically, do not edit */" > $out
echo "" >> $out
echo "#include \"profiles.h\"" >> $out
echo "" >> $out
echo "VipsCodedProfile vips__coded_profiles[] = {" >> $out
profile_names=
for file in $in/*; do
root=${file%.icm}
base=${root##*/}
echo " { \"$base\"," >> $out
base64 $file | sed 's/\(.*\)/"\1"/g' >> $out
echo " }," >> $out
profile_name=vips__profile_fallback_$base
profile_names="$profile_names $profile_name"
echo "static VipsProfileFallback $profile_name = {" >> $out
echo " \"$base\"," >> $out
echo " $(stat --format=%s $file)," >> $out
echo " {" >> $out
hexdump -v -e '" 0x" 1/1 "%02X,"' $file | fmt >> $out
echo " }" >> $out
echo "};" >> $out
echo >> $out
done
echo " { 0, 0 }" >> $out
echo "VipsProfileFallback *vips__profile_fallback_table[] = {" >> $out
for profile_name in $profile_names; do
echo " &$profile_name," >> $out
done
echo " NULL" >> $out
echo "};" >> $out

View File

@ -158,6 +158,18 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION );
q[x] = (p[x] << n) | (((p[x] & 1) << n) - (p[x] & 1)); \
}
#define SHIFT_LEFT_SIGNED( ITYPE, OTYPE ) { \
ITYPE * restrict p = (ITYPE *) in; \
OTYPE * restrict q = (OTYPE *) out; \
int n = ((int) sizeof( OTYPE ) << 3) - ((int) sizeof( ITYPE ) << 3); \
\
g_assert( sizeof( ITYPE ) < sizeof( OTYPE ) ); \
\
for( x = 0; x < sz; x++ ) \
q[x] = VIPS_LSHIFT_INT( p[x], n ) | \
(((p[x] & 1) << n) - (p[x] & 1)); \
}
/* Cast int types to an int type. We need to pass in the type of the
* intermediate value, either uint or int, or we'll have problems with uint
* sources turning -ve.
@ -188,6 +200,21 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION );
} \
}
/* Int to int handling for signed int types.
*/
#define INT_INT_SIGNED( ITYPE, OTYPE, TEMP, CAST ) { \
if( cast->shift && \
sizeof( ITYPE ) > sizeof( OTYPE ) ) { \
SHIFT_RIGHT( ITYPE, OTYPE ); \
} \
else if( cast->shift ) { \
SHIFT_LEFT_SIGNED( ITYPE, OTYPE ); \
} \
else { \
CAST_INT_INT( ITYPE, OTYPE, TEMP, CAST ); \
} \
}
/* Cast float types to an int type.
*/
#define CAST_FLOAT_INT( ITYPE, OTYPE, TEMP, CAST ) { \
@ -336,7 +363,7 @@ vips_cast_gen( VipsRegion *or, void *vseq, void *a, void *b, gboolean *stop )
case VIPS_FORMAT_CHAR:
BAND_SWITCH_INNER( signed char,
INT_INT,
INT_INT_SIGNED,
CAST_REAL_FLOAT,
CAST_REAL_COMPLEX );
break;
@ -350,7 +377,7 @@ vips_cast_gen( VipsRegion *or, void *vseq, void *a, void *b, gboolean *stop )
case VIPS_FORMAT_SHORT:
BAND_SWITCH_INNER( signed short,
INT_INT,
INT_INT_SIGNED,
CAST_REAL_FLOAT,
CAST_REAL_COMPLEX );
break;
@ -364,7 +391,7 @@ vips_cast_gen( VipsRegion *or, void *vseq, void *a, void *b, gboolean *stop )
case VIPS_FORMAT_INT:
BAND_SWITCH_INNER( signed int,
INT_INT,
INT_INT_SIGNED,
CAST_REAL_FLOAT,
CAST_REAL_COMPLEX );
break;

View File

@ -1721,7 +1721,18 @@ vips_composite2( VipsImage *base, VipsImage *overlay, VipsImage **out,
va_list ap;
int result;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wvarargs"
/* Triggers a clang compiler warning because mode might not be an int.
* I think the warning is harmless for all platforms we care about.
*/
va_start( ap, mode );
g_assert( sizeof( mode ) == sizeof( int ) );
#pragma clang diagnostic pop
result = vips_call_split( "composite2", ap, base, overlay, out, mode );
va_end( ap );

View File

@ -99,6 +99,25 @@ G_DEFINE_TYPE( VipsFlatten, vips_flatten, VIPS_TYPE_CONVERSION );
} \
}
/* Same, but with float arithmetic. Necessary for short/int to prevent
* overflow.
*/
#define VIPS_FLATTEN_BLACK_FLOAT( TYPE ) { \
TYPE * restrict p = (TYPE *) in; \
TYPE * restrict q = (TYPE *) out; \
\
for( x = 0; x < width; x++ ) { \
TYPE alpha = p[bands - 1]; \
int b; \
\
for( b = 0; b < bands - 1; b++ ) \
q[b] = ((double) p[b] * alpha) / max_alpha; \
\
p += bands; \
q += bands - 1; \
} \
}
/* Flatten with any background.
*/
#define VIPS_FLATTEN( TYPE ) { \
@ -119,25 +138,6 @@ G_DEFINE_TYPE( VipsFlatten, vips_flatten, VIPS_TYPE_CONVERSION );
} \
}
/* Same, but with float arithmetic. Necessary for int/uint to prevent
* overflow.
*/
#define VIPS_FLATTEN_BLACK_FLOAT( TYPE ) { \
TYPE * restrict p = (TYPE *) in; \
TYPE * restrict q = (TYPE *) out; \
\
for( x = 0; x < width; x++ ) { \
TYPE alpha = p[bands - 1]; \
int b; \
\
for( b = 0; b < bands - 1; b++ ) \
q[b] = ((double) p[b] * alpha) / max_alpha; \
\
p += bands; \
q += bands - 1; \
} \
}
#define VIPS_FLATTEN_FLOAT( TYPE ) { \
TYPE * restrict p = (TYPE *) in; \
TYPE * restrict q = (TYPE *) out; \
@ -187,11 +187,11 @@ vips_flatten_black_gen( VipsRegion *or, void *vseq, void *a, void *b,
break;
case VIPS_FORMAT_USHORT:
VIPS_FLATTEN_BLACK( unsigned short );
VIPS_FLATTEN_BLACK_FLOAT( unsigned short );
break;
case VIPS_FORMAT_SHORT:
VIPS_FLATTEN_BLACK( signed short );
VIPS_FLATTEN_BLACK_FLOAT( signed short );
break;
case VIPS_FORMAT_UINT:
@ -252,11 +252,11 @@ vips_flatten_gen( VipsRegion *or, void *vseq, void *a, void *b,
break;
case VIPS_FORMAT_USHORT:
VIPS_FLATTEN( unsigned short );
VIPS_FLATTEN_FLOAT( unsigned short );
break;
case VIPS_FORMAT_SHORT:
VIPS_FLATTEN( signed short );
VIPS_FLATTEN_FLOAT( signed short );
break;
case VIPS_FORMAT_UINT:

View File

@ -418,7 +418,7 @@ vips_rect_hash( VipsRect *pos )
* X discrimination is more important than Y, since
* most tiles will have a similar Y.
*/
hash = pos->left ^ (pos->top << 16);
hash = (guint) pos->left ^ ((guint) pos->top << 16);
return( hash );
}

View File

@ -80,7 +80,7 @@ G_DEFINE_TYPE( VipsUnpremultiply, vips_unpremultiply, VIPS_TYPE_CONVERSION );
IN clip_alpha = VIPS_CLIP( 0, alpha, max_alpha ); \
OUT nalpha = (OUT) clip_alpha / max_alpha; \
\
if( clip_alpha == 0 ) \
if( nalpha == 0 ) \
for( i = 0; i < bands - 1; i++ ) \
q[i] = 0; \
else \
@ -104,7 +104,7 @@ G_DEFINE_TYPE( VipsUnpremultiply, vips_unpremultiply, VIPS_TYPE_CONVERSION );
IN clip_alpha = VIPS_CLIP( 0, alpha, max_alpha ); \
OUT nalpha = (OUT) clip_alpha / max_alpha; \
\
if( clip_alpha == 0 ) { \
if( nalpha == 0 ) { \
q[0] = 0; \
q[1] = 0; \
q[2] = 0; \

View File

@ -123,6 +123,7 @@
#include <limits.h>
#include <vips/vips.h>
#include <vips/internal.h>
#include "pconvolution.h"
@ -979,7 +980,7 @@ vips_convi_intize( VipsConvi *convi, VipsImage *M )
if( convi->exp > 0 )
int_value = (int_sum + (1 << (convi->exp - 1))) >> convi->exp;
else
int_value = int_sum << convi->exp;
int_value = VIPS_LSHIFT_INT( int_sum, convi->exp );
int_value = VIPS_CLIP( 0, int_value, 255 );
if( VIPS_ABS( true_value - int_value ) > 2 ) {

View File

@ -300,7 +300,8 @@ vips_foreign_save_heif_build( VipsObject *object )
return( -1 );
error = heif_context_get_encoder_for_format( heif->ctx,
heif->compression, &heif->encoder );
(enum heif_compression_format) heif->compression,
&heif->encoder );
if( error.code ) {
if( error.code == heif_error_Unsupported_filetype )
vips_error( "heifsave",

View File

@ -442,7 +442,7 @@ vips_foreign_save_jpeg_mime_init( VipsForeignSaveJpegMime *mime )
* contains an ICC profile named #VIPS_META_ICC_NAME, the
* profile from the VIPS header will be attached.
*
* If @optimize_coding is set, the Huffman tables are optimised. This is
* If @optimize_coding is set, the Huffman tables are optimized. This is
* sllightly slower and produces slightly smaller files.
*
* If @interlace is set, the jpeg files will be interlaced (progressive jpeg,

View File

@ -48,6 +48,50 @@
#include "pforeign.h"
#include "magick.h"
#if defined(HAVE_MAGICK6) || defined(HAVE_MAGICK7)
/* ImageMagick can't detect some formats, like ICO, by examining the contents --
* ico.c simply does not have a recogniser.
*
* For these formats, do the detection ourselves.
*
* Return an IM format specifier, or NULL to let IM do the detection.
*/
static const char *
magick_sniff( const unsigned char *bytes, size_t length )
{
if( length >= 4 &&
bytes[0] == 0 &&
bytes[1] == 0 &&
bytes[2] == 1 &&
bytes[3] == 0 )
return( "ICO" );
return( NULL );
}
void
magick_sniff_bytes( ImageInfo *image_info,
const unsigned char *bytes, size_t length )
{
const char *format;
if( (format = magick_sniff( bytes, length )) )
vips_strncpy( image_info->magick, format, MaxTextExtent );
}
void
magick_sniff_file( ImageInfo *image_info, const char *filename )
{
unsigned char bytes[256];
size_t length;
if( (length = vips__get_bytes( filename, bytes, 256 )) >= 4 )
magick_sniff_bytes( image_info, bytes, 256 );
}
#endif /*defined(HAVE_MAGICK6) || defined(HAVE_MAGICK7)*/
#ifdef HAVE_MAGICK7
Image *
@ -165,6 +209,46 @@ magick_set_number_scenes( ImageInfo *image_info, int scene, int number_scenes )
image_info->scenes = strdup( page );
}
int
magick_optimize_image_layers( Image **images, ExceptionInfo *exception )
{
Image *tmp;
tmp = OptimizePlusImageLayers(*images, exception );
if ( exception->severity != UndefinedException )
return MagickFalse;
VIPS_FREEF( DestroyImageList, *images );
*images = tmp;
return MagickTrue;
}
int
magick_optimize_image_transparency( const Image *images,
ExceptionInfo *exception )
{
OptimizeImageTransparency(images, exception);
return ( exception->severity == UndefinedException );
}
/* Does a few bytes look like a file IM can handle?
*/
gboolean
magick_ismagick( const unsigned char *bytes, size_t length )
{
char format[MagickPathExtent];
magick_genesis();
/* Try with our custom sniffers first.
*/
return( magick_sniff( bytes, length ) ||
GetImageMagick( bytes, length, format ) );
}
#endif /*HAVE_MAGICK7*/
#ifdef HAVE_MAGICK6
@ -278,7 +362,7 @@ magick_set_profile( Image *image,
string = BlobToStringInfo( data, length );
result = SetImageProfile( image, name, string );
DestroyStringInfo( string );
#else /*HAVE_BLOBTOSTRINGINFO*/
#else /*!HAVE_BLOBTOSTRINGINFO*/
result = SetImageProfile( image, name, data, length );
#endif /*HAVE_BLOBTOSTRINGINFO*/
@ -390,6 +474,67 @@ magick_set_number_scenes( ImageInfo *image_info, int scene, int number_scenes )
#endif
}
int
magick_optimize_image_layers( Image **images, ExceptionInfo *exception )
{
#ifdef HAS_OPTIMIZEPLUSIMAGELAYERS
Image *tmp;
tmp = OptimizePlusImageLayers(*images, exception );
if ( exception->severity != UndefinedException )
return MagickFalse;
VIPS_FREEF( DestroyImageList, *images );
*images = tmp;
return MagickTrue;
#else
g_warning( "%s", _( "layers optimization is not supported by your version "
"of libMagick" ) );
return MagickTrue;
#endif
}
int
magick_optimize_image_transparency( const Image *images,
ExceptionInfo *exception )
{
#ifdef HAS_OPTIMIZEIMAGETRANSPARENCY
OptimizeImageTransparency(images, exception);
return ( exception->severity == UndefinedException );
#else
g_warning( "%s", _( "transparency optimization is not supported by your "
"version of libMagick" ) );
return MagickTrue;
#endif
}
/* Does a few bytes look like a file IM can handle?
*/
gboolean
magick_ismagick( const unsigned char *bytes, size_t length )
{
magick_genesis();
/* Try with our custom sniffers first.
*/
#ifdef HAVE_GETIMAGEMAGICK3
{
char format[MaxTextExtent];
return( magick_sniff( bytes, length ) ||
GetImageMagick( bytes, length, format ) );
}
#else /*!HAVE_GETIMAGEMAGICK3*/
/* The GM one returns a static string.
*/
return( magick_sniff( bytes, length ) ||
GetImageMagick( bytes, length ) );
#endif
}
#endif /*HAVE_MAGICK6*/
#if defined(HAVE_MAGICK6) || defined(HAVE_MAGICK7)
@ -410,16 +555,32 @@ typedef struct _MagickColorspaceTypeNames {
static MagickColorspaceTypeNames magick_colorspace_names[] = {
{ UndefinedColorspace, "UndefinedColorspace" },
{ CMYColorspace, "CMYColorspace" },
{ CMYKColorspace, "CMYKColorspace" },
{ GRAYColorspace, "GRAYColorspace" },
{ HSLColorspace, "HSLColorspace" },
{ HWBColorspace, "HWBColorspace" },
{ OHTAColorspace, "OHTAColorspace" },
{ Rec601YCbCrColorspace, "Rec601YCbCrColorspace" },
{ Rec709YCbCrColorspace, "Rec709YCbCrColorspace" },
{ RGBColorspace, "RGBColorspace" },
{ sRGBColorspace, "sRGBColorspace" },
{ TransparentColorspace, "TransparentColorspace" },
{ XYZColorspace, "XYZColorspace" },
{ YCbCrColorspace, "YCbCrColorspace" },
{ YCCColorspace, "YCCColorspace" },
{ YIQColorspace, "YIQColorspace" },
{ YPbPrColorspace, "YPbPrColorspace" },
{ YUVColorspace, "YUVColorspace" },
/* More recent imagemagicks add these.
*/
#ifdef HAVE_CMYCOLORSPACE
{ CMYColorspace, "CMYColorspace" },
{ HCLColorspace, "HCLColorspace" },
{ HCLpColorspace, "HCLpColorspace" },
{ HSBColorspace, "HSBColorspace" },
{ HSIColorspace, "HSIColorspace" },
{ HSLColorspace, "HSLColorspace" },
{ HSVColorspace, "HSVColorspace" },
{ HWBColorspace, "HWBColorspace" },
{ LabColorspace, "LabColorspace" },
{ LCHColorspace, "LCHColorspace" },
{ LCHabColorspace, "LCHabColorspace" },
@ -427,23 +588,12 @@ static MagickColorspaceTypeNames magick_colorspace_names[] = {
{ LogColorspace, "LogColorspace" },
{ LMSColorspace, "LMSColorspace" },
{ LuvColorspace, "LuvColorspace" },
{ OHTAColorspace, "OHTAColorspace" },
{ Rec601YCbCrColorspace, "Rec601YCbCrColorspace" },
{ Rec709YCbCrColorspace, "Rec709YCbCrColorspace" },
{ RGBColorspace, "RGBColorspace" },
{ scRGBColorspace, "scRGBColorspace" },
{ sRGBColorspace, "sRGBColorspace" },
{ TransparentColorspace, "TransparentColorspace" },
{ xyYColorspace, "xyYColorspace" },
{ XYZColorspace, "XYZColorspace" },
{ YCbCrColorspace, "YCbCrColorspace" },
{ YCCColorspace, "YCCColorspace" },
{ YDbDrColorspace, "YDbDrColorspace" },
{ YIQColorspace, "YIQColorspace" },
{ YPbPrColorspace, "YPbPrColorspace" },
{ YUVColorspace, "YUVColorspace" }
#endif /*HAVE_CMYCOLORSPACE*/
/* More recent imagemagicks add these.
/* im7 has this, I think
*
{ LinearGRAYColorspace, "LinearGRAYColorspace" }
*
@ -462,46 +612,6 @@ magick_ColorspaceType2str( ColorspaceType colorspace )
return( "<unknown ColorspaceType>" );
}
/* ImageMagick can't detect some formats, like ICO, by examining the contents --
* ico.c simply does not have a recogniser.
*
* For these formats, do the detection ourselves.
*
* Return an IM format specifier, or NULL to let IM do the detection.
*/
static const char *
magick_sniff( const unsigned char *bytes, size_t length )
{
if( length >= 4 &&
bytes[0] == 0 &&
bytes[1] == 0 &&
bytes[2] == 1 &&
bytes[3] == 0 )
return( "ICO" );
return( NULL );
}
void
magick_sniff_bytes( ImageInfo *image_info,
const unsigned char *bytes, size_t length )
{
const char *format;
if( (format = magick_sniff( bytes, length )) )
vips_strncpy( image_info->magick, format, MaxTextExtent );
}
void
magick_sniff_file( ImageInfo *image_info, const char *filename )
{
unsigned char bytes[256];
size_t length;
if( (length = vips__get_bytes( filename, bytes, 256 )) >= 4 )
magick_sniff_bytes( image_info, bytes, 256 );
}
void
magick_vips_error( const char *domain, ExceptionInfo *exception )
{
@ -641,23 +751,4 @@ magick_set_magick_profile( Image *image,
return( 0 );
}
/* Does a few bytes look like a file IM can handle?
*/
gboolean
magick_ismagick( const unsigned char *bytes, size_t length )
{
#ifdef HAVE_MAGICK7
char format[MagickPathExtent];
#else /*HAVE_MAGICK6*/
char format[MaxTextExtent];
#endif
magick_genesis();
/* Try with our custom sniffers first.
*/
return( magick_sniff( bytes, length ) ||
GetImageMagick( bytes, length, format ) );
}
#endif /*HAVE_MAGICK*/
#endif /*defined(HAVE_MAGICK6) || defined(HAVE_MAGICK7)*/

View File

@ -84,6 +84,10 @@ int magick_set_vips_profile( VipsImage *im, Image *image );
int magick_set_magick_profile( Image *image,
VipsImage *im, ExceptionInfo *exception );
int magick_optimize_image_layers( Image **images, ExceptionInfo *exception );
int magick_optimize_image_transparency( const Image *images,
ExceptionInfo *exception );
gboolean magick_ismagick( const unsigned char *bytes, size_t length );
#endif /*HAVE_MAGICK6*/

View File

@ -10,6 +10,8 @@
* - support "strip" option
* 6/7/19 [deftomat]
* - support array of delays
* 5/8/19 DarthSim
* - support GIF optimization
*/
/*
@ -63,6 +65,8 @@ typedef struct _VipsForeignSaveMagick {
char *filename; /* NULL during buffer output */
char *format;
int quality;
gboolean optimize_gif_frames;
gboolean optimize_gif_transparency;
ImageInfo *image_info;
ExceptionInfo *exception;
@ -365,6 +369,24 @@ vips_foreign_save_magick_build( VipsObject *object )
vips_foreign_save_magick_write_block, magick ) )
return( -1 );
if( magick->optimize_gif_frames ) {
if( !magick_optimize_image_layers(&magick->images, magick->exception ) ) {
magick_inherit_exception( magick->exception, magick->images );
magick_vips_error( class->nickname, magick->exception );
return( -1 );
}
}
if( magick->optimize_gif_transparency ) {
if( !magick_optimize_image_transparency(magick->images, magick->exception) ) {
magick_inherit_exception( magick->exception, magick->images );
magick_vips_error( class->nickname, magick->exception );
return( -1 );
}
}
return( 0 );
}
@ -428,6 +450,20 @@ vips_foreign_save_magick_class_init( VipsForeignSaveMagickClass *class )
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignSaveMagick, quality ),
0, 100, 0 );
VIPS_ARG_BOOL( class, "optimize_gif_frames", 4,
_( "Optimize_gif_frames" ),
_( "Apply GIF frames optimization" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignSaveMagick, optimize_gif_frames ),
FALSE );
VIPS_ARG_BOOL( class, "optimize_gif_transparency", 5,
_( "Optimize_gif_transparency" ),
_( "Apply GIF transparency optimization" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignSaveMagick, optimize_gif_transparency ),
FALSE );
}
static void
@ -586,6 +622,8 @@ vips_foreign_save_magick_buffer_init( VipsForeignSaveMagickBuffer *buffer )
*
* * @quality: %gint, quality factor
* * @format: %gchararray, format to save as
* * @optimize_gif_frames: %gboolean, apply GIF frames optimization
* * @optimize_gif_transparency: %gboolean, apply GIF transparency optimization
*
* Write an image using libMagick.
*
@ -594,6 +632,15 @@ vips_foreign_save_magick_buffer_init( VipsForeignSaveMagickBuffer *buffer )
* Use @format to explicitly set the save format, for example, "BMP". Otherwise
* the format is guessed from the filename suffix.
*
* If @optimize_gif_frames is set, GIF frames are cropped to the smallest size
* while preserving the results of the GIF animation. This takes some time for
* computation but saves some time on encoding and produces smaller files in
* some cases.
*
* If @optimize_gif_transparency is set, pixels that don't change the image
* through animation are made transparent. This takes some time for computation
* but saves some time on encoding and produces smaller files in some cases.
*
* See also: vips_magicksave_buffer(), vips_magickload().
*
* Returns: 0 on success, -1 on error.
@ -622,6 +669,8 @@ vips_magicksave( VipsImage *in, const char *filename, ... )
*
* * @quality: %gint, quality factor
* * @format: %gchararray, format to save as
* * @optimize_gif_frames: %gboolean, apply GIF frames optimization
* * @optimize_gif_transparency: %gboolean, apply GIF transparency optimization
*
* As vips_magicksave(), but save to a memory buffer.
*

View File

@ -6,6 +6,8 @@
* - add background param
* 16/8/18
* - shut down the input file as soon as we can [kleisauke]
* 8/8/19
* - add locks, since pdfium is not threadsafe in any way
*/
/*
@ -139,8 +141,12 @@ vips_pdfium_error( void )
static void
vips_foreign_load_pdf_close( VipsForeignLoadPdf *pdf )
{
g_mutex_lock( vips__global_lock );
VIPS_FREEF( FPDF_ClosePage, pdf->page );
VIPS_FREEF( FPDF_CloseDocument, pdf->doc );
g_mutex_unlock( vips__global_lock );
}
static void
@ -209,6 +215,8 @@ vips_foreign_load_pdf_get_page( VipsForeignLoadPdf *pdf, int page_no )
if( pdf->current_page != page_no ) {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( pdf );
g_mutex_lock( vips__global_lock );
VIPS_FREEF( FPDF_ClosePage, pdf->page );
pdf->current_page = -1;
@ -217,12 +225,15 @@ vips_foreign_load_pdf_get_page( VipsForeignLoadPdf *pdf, int page_no )
#endif /*DEBUG*/
if( !(pdf->page = FPDF_LoadPage( pdf->doc, page_no )) ) {
g_mutex_unlock( vips__global_lock );
vips_pdfium_error();
vips_error( class->nickname,
_( "unable to load page %d" ), page_no );
return( -1 );
}
pdf->current_page = page_no;
g_mutex_unlock( vips__global_lock );
}
return( 0 );
@ -272,7 +283,9 @@ vips_foreign_load_pdf_set_image( VipsForeignLoadPdf *pdf, VipsImage *out )
char text[1024];
int len;
g_mutex_lock( vips__global_lock );
len = FPDF_GetMetaText( pdf->doc, metadata->tag, text, 1024 );
g_mutex_unlock( vips__global_lock );
if( len > 0 ) {
char *str;
@ -312,7 +325,9 @@ vips_foreign_load_pdf_header( VipsForeignLoad *load )
printf( "vips_foreign_load_pdf_header: %p\n", pdf );
#endif /*DEBUG*/
g_mutex_lock( vips__global_lock );
pdf->n_pages = FPDF_GetPageCount( pdf->doc );
g_mutex_unlock( vips__global_lock );
/* @n == -1 means until the end of the doc.
*/
@ -431,6 +446,8 @@ vips_foreign_load_pdf_generate( VipsRegion *or,
/* 4 means RGBA.
*/
g_mutex_lock( vips__global_lock );
bitmap = FPDFBitmap_CreateEx( rect.width, rect.height, 4,
VIPS_REGION_ADDR( or, rect.left, rect.top ),
VIPS_REGION_LSKIP( or ) );
@ -441,6 +458,8 @@ vips_foreign_load_pdf_generate( VipsRegion *or,
FPDFBitmap_Destroy( bitmap );
g_mutex_unlock( vips__global_lock );
top += rect.height;
i += 1;
}
@ -588,13 +607,18 @@ vips_foreign_load_pdf_file_header( VipsForeignLoad *load )
VipsForeignLoadPdf *pdf = (VipsForeignLoadPdf *) load;
VipsForeignLoadPdfFile *file = (VipsForeignLoadPdfFile *) load;
g_mutex_lock( vips__global_lock );
if( !(pdf->doc = FPDF_LoadDocument( file->filename, NULL )) ) {
g_mutex_unlock( vips__global_lock );
vips_pdfium_error();
vips_error( "pdfload",
_( "unable to load \"%s\"" ), file->filename );
return( -1 );
}
g_mutex_unlock( vips__global_lock );
VIPS_SETSTR( load->out->filename, file->filename );
return( vips_foreign_load_pdf_header( load ) );
@ -659,14 +683,19 @@ vips_foreign_load_pdf_buffer_header( VipsForeignLoad *load )
VipsForeignLoadPdfBuffer *buffer =
(VipsForeignLoadPdfBuffer *) load;
g_mutex_lock( vips__global_lock );
if( !(pdf->doc = FPDF_LoadMemDocument( buffer->buf->data,
buffer->buf->length, NULL )) ) {
g_mutex_unlock( vips__global_lock );
vips_pdfium_error();
vips_error( "pdfload",
"%s", _( "unable to load from buffer" ) );
return( -1 );
}
g_mutex_unlock( vips__global_lock );
return( vips_foreign_load_pdf_header( load ) );
}

View File

@ -34,6 +34,8 @@
* 4/6/15
* - try to support DOS files under linux ... we have to look for \r\n
* linebreaks
* 29/7/19 Kyle-Kyle
* - fix a loop with malformed ppm
*/
/*
@ -89,7 +91,10 @@
static void
skip_line( FILE *fp )
{
while( vips__fgetc( fp ) != '\n' )
int ch;
while( (ch = vips__fgetc( fp )) != '\n' &&
ch != EOF )
;
}
@ -401,7 +406,7 @@ read_1bit_binary( FILE *fp, VipsImage *out )
for( y = 0; y < out->Ysize; y++ ) {
for( x = 0; x < out->Xsize * out->Bands; x++ ) {
buf[x] = (bits & 128) ? 0 : 255;
bits <<= 1;
bits = VIPS_LSHIFT_INT( bits, 1 );
if( (x & 7) == 7 )
bits = fgetc( fp );
}
@ -662,7 +667,7 @@ write_ppm_line_binary_squash( Write *write, VipsPel *p )
bits = 0;
n_bits = 0;
for( x = 0; x < write->in->Xsize; x++ ) {
bits <<= 1;
bits = VIPS_LSHIFT_INT( bits, 1 );
n_bits += 1;
bits |= p[x] ? 0 : 1;

View File

@ -937,19 +937,27 @@ rtiff_greyscale_line( Rtiff *rtiff,
int samples_per_pixel = rtiff->header.samples_per_pixel;
int photometric_interpretation =
rtiff->header.photometric_interpretation;
gboolean invert = photometric_interpretation == PHOTOMETRIC_MINISWHITE;
VipsBandFormat format = rtiff_guess_format( rtiff );
/* Swapping black and white doesn't make sense for the signed formats.
*/
gboolean invert =
photometric_interpretation == PHOTOMETRIC_MINISWHITE &&
vips_band_format_isuint( format );
int x, i;
switch( format ) {
case VIPS_FORMAT_UCHAR:
case VIPS_FORMAT_CHAR:
GREY_LOOP( guchar, 0 );
break;
case VIPS_FORMAT_UCHAR:
GREY_LOOP( guchar, UCHAR_MAX );
break;
case VIPS_FORMAT_SHORT:
GREY_LOOP( gshort, SHRT_MAX );
GREY_LOOP( gshort, 0 );
break;
case VIPS_FORMAT_USHORT:
@ -957,7 +965,7 @@ rtiff_greyscale_line( Rtiff *rtiff,
break;
case VIPS_FORMAT_INT:
GREY_LOOP( gint, INT_MAX );
GREY_LOOP( gint, 0 );
break;
case VIPS_FORMAT_UINT:
@ -1066,7 +1074,7 @@ rtiff_palette_line_bit( Rtiff *rtiff,
}
}
else
*q++ = i << (8 - bits_per_sample);
*q++ = VIPS_LSHIFT_INT( i, 8 - bits_per_sample );
}
}
@ -2189,6 +2197,18 @@ rtiff_header_read( Rtiff *rtiff, RtiffHeader *header )
header->tile_size = TIFFTileSize( rtiff->tiff );
header->tile_row_size = TIFFTileRowSize( rtiff->tiff );
/* Fuzzed TIFFs can give crazy values for tile_size. Sanity
* check at 100mb per tile.
*/
if( header->tile_size <= 0 ||
header->tile_size > 100 * 1000 * 1000 ||
header->tile_row_size <= 0 ||
header->tile_row_size > 100 * 1000 * 1000 ) {
vips_error( "tiff2vips",
"%s", _( "tile size out of range" ) );
return( -1 );
}
/* Stop some compiler warnings.
*/
header->rows_per_strip = 0;

View File

@ -1245,7 +1245,7 @@ LabS2Lab16( VipsPel *q, VipsPel *p, int n )
for( x = 0; x < n; x++ ) {
/* TIFF uses unsigned 16 bit ... move zero, scale up L.
*/
q1[0] = (int) p1[0] << 1;
q1[0] = VIPS_LSHIFT_INT( (int) p1[0], 1 );
q1[1] = p1[1];
q1[2] = p1[2];

View File

@ -994,12 +994,13 @@ write_png_comment( VipsImage *image,
if( vips_isprefix( "png-comment-", field ) ) {
const char *str;
int i;
char key[80];
char key[256];
if( vips_image_get_string( write->in, field, &str ) )
return( image );
if( sscanf( field, "png-comment-%d-%80s", &i, key ) != 2 ) {
if( strlen( field ) > 256 ||
sscanf( field, "png-comment-%d-%80s", &i, key ) != 2 ) {
vips_error( "vips2png",
"%s", _( "bad png comment key" ) );
return( image );

View File

@ -248,7 +248,8 @@ vips_image_paint_area( VipsImage *image, const VipsRect *r, const VipsPel *ink )
/* Rebuild RGBA, assuming little-endian.
*/
#define setRGBA( R, G, B, A ) (R | (G << 8) | (B << 16) | (A << 24))
#define setRGBA( R, G, B, A ) \
(R | (G << 8) | (B << 16) | ((guint32) A << 24))
/* OVER blend of two unpremultiplied RGBA guint32
*

View File

@ -459,7 +459,7 @@ vips_foreign_save_webp_mime_init( VipsForeignSaveWebpMime *mime )
* with @Q 80, 60, 40 or 20 to apply increasing amounts of preprocessing
* which improves the near-lossless compression ratio by up to 50%.
*
* For animated webp output, @min_size will try to optimise for minimum size.
* For animated webp output, @min_size will try to optimize for minimum size.
*
* For animated webp output, @kmax sets the maximum number of frames between
* keyframes. Setting 0 means only keyframes. @kmin sets the minimum number of

View File

@ -638,7 +638,9 @@ int vips_dzsave( VipsImage *in, const char *name, ... )
* @VIPS_FOREIGN_HEIF_COMPRESSION_JPEG: jpeg
* @VIPS_FOREIGN_HEIF_COMPRESSION_AV1: aom
*
* The compression format to use inside a HEIF container.
* The compression format to use inside a HEIF container.
*
* This is assumed to use the same numbering as %heif_compression_format.
*/
typedef enum {
VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1,

View File

@ -39,6 +39,14 @@
extern "C" {
#endif /*__cplusplus*/
/* << on an int is undefined in C if the int is negative. Imagine a machine
* that uses 1s complement, for example.
*
* Fuzzers find and warn about this, so we must use this macro instead. Cast
* to uint, shift, and cast back.
*/
#define VIPS_LSHIFT_INT( I, N ) ((int) ((unsigned int) (I) << (N)))
/* What we store in the Meta hash table. We can't just use GHashTable's
* key/value pairs, since we need to iterate over meta in Meta_traverse order.
*

View File

@ -143,7 +143,7 @@ read24( const unsigned char *in, int remaining )
bits = 0;
for( i = 0; i < 3; i++ ) {
bits <<= 8;
bits = VIPS_LSHIFT_INT( bits, 8 );
if( remaining > 0 ) {
bits |= in[i];
remaining -= 1;
@ -167,7 +167,7 @@ encode24( char *p, int bits, int remaining )
/* Take the top 6 bits of 24.
*/
p[i] = b64_list[(bits >> 18) & 63];
bits <<= 6;
bits = VIPS_LSHIFT_INT( bits, 6 );
remaining -= 6;
}
}
@ -281,7 +281,7 @@ vips__b64_decode( const char *buffer, size_t *data_length )
unsigned int val;
if( (val = b64_index[(int) buffer[i]]) != XX ) {
bits <<= 6;
bits = VIPS_LSHIFT_INT( bits, 6 );
bits |= val;
nbits += 6;

View File

@ -796,15 +796,15 @@ vips_image_get_page_height( VipsImage *image )
{
int page_height;
if( !vips_image_get_typeof( image, VIPS_META_PAGE_HEIGHT ) ||
vips_image_get_int( image, VIPS_META_PAGE_HEIGHT,
&page_height ) ||
page_height <= 0 ||
page_height > image->Ysize ||
image->Ysize % page_height != 0 )
page_height = image->Ysize;
if( vips_image_get_typeof( image, VIPS_META_PAGE_HEIGHT ) &&
!vips_image_get_int( image, VIPS_META_PAGE_HEIGHT,
&page_height ) &&
page_height > 0 &&
page_height < image->Ysize &&
image->Ysize % page_height == 0 )
return( page_height );
return( page_height );
return( image->Ysize );
}
/**
@ -824,13 +824,13 @@ vips_image_get_n_pages( VipsImage *image )
{
int n_pages;
if( !vips_image_get_typeof( image, VIPS_META_N_PAGES ) ||
vips_image_get_int( image, VIPS_META_N_PAGES, &n_pages ) ||
n_pages < 2 ||
n_pages > 1000 )
n_pages = 1;
if( vips_image_get_typeof( image, VIPS_META_N_PAGES ) &&
!vips_image_get_int( image, VIPS_META_N_PAGES, &n_pages ) &&
n_pages > 1 &&
n_pages < 1000 )
return( n_pages );
return( n_pages );
return( 1 );
}
/**

View File

@ -1458,7 +1458,7 @@ vips_image_minimise_all( VipsImage *image )
*
* TRUE if any of the images upstream from @image were opened in sequential
* mode. Some operations change behaviour slightly in sequential mode to
* optimise memory behaviour.
* optimize memory behaviour.
*
* Returns: %TRUE if @image is in sequential mode.
*/

View File

@ -63,7 +63,7 @@
#endif /*OS_WIN32*/
/* Sanity checking ... write to this during read tests to make sure we don't
* get optimised out.
* get optimized out.
*/
int vips__read_test;

View File

@ -6,6 +6,8 @@
* - reorganise loops, 30% faster, vectorisable
* 15/8/16
* - rename xshrink -> hshrink for greater consistency
* 6/8/19
* - use a double sum buffer for int32 types
*/
/*
@ -71,13 +73,13 @@ G_DEFINE_TYPE( VipsShrinkh, vips_shrinkh, VIPS_TYPE_RESAMPLE );
/* Integer shrink.
*/
#define ISHRINK( TYPE, BANDS ) { \
#define ISHRINK( ACC_TYPE, TYPE, BANDS ) { \
TYPE * restrict p = (TYPE *) in; \
TYPE * restrict q = (TYPE *) out; \
\
for( x = 0; x < width; x++ ) { \
for( b = 0; b < BANDS; b++ ) { \
int sum; \
ACC_TYPE sum; \
\
sum = 0; \
x1 = b; \
@ -137,26 +139,26 @@ vips_shrinkh_gen2( VipsShrinkh *shrink, VipsRegion *or, VipsRegion *ir,
*/
switch( bands ) {
case 1:
ISHRINK( unsigned char, 1 ); break;
ISHRINK( int, unsigned char, 1 ); break;
case 3:
ISHRINK( unsigned char, 3 ); break;
ISHRINK( int, unsigned char, 3 ); break;
case 4:
ISHRINK( unsigned char, 4 ); break;
ISHRINK( int, unsigned char, 4 ); break;
default:
ISHRINK( unsigned char, bands ); break;
ISHRINK( int, unsigned char, bands ); break;
}
break;
case VIPS_FORMAT_CHAR:
ISHRINK( char, bands ); break;
ISHRINK( int, char, bands ); break;
case VIPS_FORMAT_USHORT:
ISHRINK( unsigned short, bands ); break;
ISHRINK( int, unsigned short, bands ); break;
case VIPS_FORMAT_SHORT:
ISHRINK( short, bands ); break;
ISHRINK( int, short, bands ); break;
case VIPS_FORMAT_UINT:
ISHRINK( unsigned int, bands ); break;
ISHRINK( double, unsigned int, bands ); break;
case VIPS_FORMAT_INT:
ISHRINK( int, bands ); break;
ISHRINK( double, int, bands ); break;
case VIPS_FORMAT_FLOAT:
FSHRINK( float ); break;
case VIPS_FORMAT_DOUBLE:

View File

@ -45,6 +45,8 @@
* - rename yshrink -> vshrink for greater consistency
* 7/3/17
* - add a seq line cache
* 6/8/19
* - use a double sum buffer for int32 types
*/
/*
@ -180,9 +182,9 @@ vips_shrinkv_add_line( VipsShrinkv *shrink, VipsShrinkvSequence *seq,
case VIPS_FORMAT_SHORT:
ADD( int, short ); break;
case VIPS_FORMAT_UINT:
ADD( int, unsigned int ); break;
ADD( double, unsigned int ); break;
case VIPS_FORMAT_INT:
ADD( int, int ); break;
ADD( double, int ); break;
case VIPS_FORMAT_FLOAT:
ADD( double, float ); break;
case VIPS_FORMAT_DOUBLE:
@ -199,8 +201,8 @@ vips_shrinkv_add_line( VipsShrinkv *shrink, VipsShrinkvSequence *seq,
/* Integer average.
*/
#define IAVG( TYPE ) { \
int * restrict sum = (int *) seq->sum; \
#define IAVG( ACC_TYPE, TYPE ) { \
ACC_TYPE * restrict sum = (ACC_TYPE *) seq->sum; \
TYPE * restrict q = (TYPE *) out; \
\
for( x = 0; x < sz; x++ ) \
@ -233,18 +235,18 @@ vips_shrinkv_write_line( VipsShrinkv *shrink, VipsShrinkvSequence *seq,
VipsPel *out = VIPS_REGION_ADDR( or, left, top );
switch( resample->in->BandFmt ) {
case VIPS_FORMAT_UCHAR:
IAVG( unsigned char ); break;
case VIPS_FORMAT_CHAR:
IAVG( char ); break;
case VIPS_FORMAT_USHORT:
IAVG( unsigned short ); break;
case VIPS_FORMAT_UCHAR:
IAVG( int, unsigned char ); break;
case VIPS_FORMAT_CHAR:
IAVG( int, char ); break;
case VIPS_FORMAT_USHORT:
IAVG( int, unsigned short ); break;
case VIPS_FORMAT_SHORT:
IAVG( short ); break;
IAVG( int, short ); break;
case VIPS_FORMAT_UINT:
IAVG( unsigned int ); break;
IAVG( double, unsigned int ); break;
case VIPS_FORMAT_INT:
IAVG( int ); break;
IAVG( double, int ); break;
case VIPS_FORMAT_FLOAT:
FAVG( float ); break;
case VIPS_FORMAT_DOUBLE:

View File

@ -1,416 +1,417 @@
libvips/arithmetic/min.c
libvips/arithmetic/sum.c
libvips/arithmetic/stats.c
libvips/arithmetic/project.c
libvips/arithmetic/hough_line.c
libvips/arithmetic/binary.c
libvips/arithmetic/deviate.c
libvips/arithmetic/max.c
libvips/arithmetic/statistic.c
libvips/arithmetic/nary.c
libvips/arithmetic/invert.c
libvips/arithmetic/remainder.c
libvips/arithmetic/boolean.c
libvips/arithmetic/sign.c
libvips/arithmetic/hist_find_ndim.c
libvips/arithmetic/multiply.c
libvips/arithmetic/hough_circle.c
libvips/arithmetic/measure.c
libvips/arithmetic/hist_find.c
libvips/arithmetic/find_trim.c
libvips/arithmetic/getpoint.c
libvips/arithmetic/add.c
libvips/arithmetic/divide.c
libvips/arithmetic/relational.c
libvips/arithmetic/hough.c
libvips/arithmetic/arithmetic.c
libvips/arithmetic/abs.c
libvips/arithmetic/avg.c
libvips/arithmetic/linear.c
libvips/arithmetic/round.c
libvips/arithmetic/math2.c
libvips/arithmetic/unaryconst.c
libvips/arithmetic/boolean.c
libvips/arithmetic/complex.c
libvips/arithmetic/hough_line.c
libvips/arithmetic/profile.c
libvips/arithmetic/unary.c
libvips/arithmetic/subtract.c
libvips/arithmetic/hist_find_indexed.c
libvips/arithmetic/sign.c
libvips/arithmetic/hough.c
libvips/arithmetic/getpoint.c
libvips/arithmetic/remainder.c
libvips/arithmetic/math.c
libvips/colour/LabQ2LabS.c
libvips/colour/rad2float.c
libvips/colour/XYZ2scRGB.c
libvips/colour/Lab2LabS.c
libvips/colour/LabS2LabQ.c
libvips/colour/float2rad.c
libvips/colour/scRGB2XYZ.c
libvips/colour/LabQ2Lab.c
libvips/colour/HSV2sRGB.c
libvips/colour/XYZ2Lab.c
libvips/colour/UCS2LCh.c
libvips/arithmetic/sum.c
libvips/arithmetic/hist_find_ndim.c
libvips/arithmetic/subtract.c
libvips/arithmetic/statistic.c
libvips/arithmetic/unary.c
libvips/arithmetic/abs.c
libvips/arithmetic/round.c
libvips/arithmetic/measure.c
libvips/arithmetic/linear.c
libvips/arithmetic/relational.c
libvips/arithmetic/multiply.c
libvips/arithmetic/deviate.c
libvips/arithmetic/unaryconst.c
libvips/arithmetic/min.c
libvips/arithmetic/add.c
libvips/arithmetic/nary.c
libvips/arithmetic/stats.c
libvips/arithmetic/binary.c
libvips/arithmetic/project.c
libvips/arithmetic/hist_find.c
libvips/arithmetic/arithmetic.c
libvips/arithmetic/divide.c
libvips/arithmetic/invert.c
libvips/arithmetic/max.c
libvips/arithmetic/find_trim.c
libvips/arithmetic/math2.c
libvips/arithmetic/avg.c
libvips/arithmetic/hist_find_indexed.c
libvips/colour/dE76.c
libvips/colour/colour.c
libvips/colour/sRGB2HSV.c
libvips/colour/Lab2LabQ.c
libvips/colour/LCh2UCS.c
libvips/colour/sRGB2scRGB.c
libvips/colour/dECMC.c
libvips/colour/scRGB2XYZ.c
libvips/colour/LabQ2LabS.c
libvips/colour/LabS2LabQ.c
libvips/colour/UCS2LCh.c
libvips/colour/profiles.c
libvips/colour/LCh2Lab.c
libvips/colour/Yxy2XYZ.c
libvips/colour/LabS2Lab.c
libvips/colour/LabQ2sRGB.c
libvips/colour/XYZ2Lab.c
libvips/colour/scRGB2BW.c
libvips/colour/Lab2LCh.c
libvips/colour/icc_transform.c
libvips/colour/scRGB2sRGB.c
libvips/colour/dE00.c
libvips/colour/sRGB2HSV.c
libvips/colour/LabQ2Lab.c
libvips/colour/LabQ2sRGB.c
libvips/colour/Lab2XYZ.c
libvips/colour/CMYK2XYZ.c
libvips/colour/XYZ2Yxy.c
libvips/colour/XYZ2scRGB.c
libvips/colour/colour.c
libvips/colour/profile_load.c
libvips/colour/Lab2LCh.c
libvips/colour/rad2float.c
libvips/colour/XYZ2CMYK.c
libvips/colour/Lab2LabQ.c
libvips/colour/dECMC.c
libvips/colour/colourspace.c
libvips/conversion/conversion.c
libvips/conversion/embed.c
libvips/conversion/zoom.c
libvips/conversion/transpose3d.c
libvips/conversion/replicate.c
libvips/conversion/bandfold.c
libvips/colour/scRGB2sRGB.c
libvips/colour/sRGB2scRGB.c
libvips/colour/LCh2UCS.c
libvips/colour/icc_transform.c
libvips/colour/dE00.c
libvips/colour/float2rad.c
libvips/colour/HSV2sRGB.c
libvips/colour/Lab2LabS.c
libvips/colour/LabS2Lab.c
libvips/conversion/bandjoin.c
libvips/conversion/wrap.c
libvips/conversion/arrayjoin.c
libvips/conversion/unpremultiply.c
libvips/conversion/flip.c
libvips/conversion/flatten.c
libvips/conversion/copy.c
libvips/conversion/bandjoin.c
libvips/conversion/rot45.c
libvips/conversion/msb.c
libvips/conversion/extract.c
libvips/conversion/cast.c
libvips/conversion/bandunfold.c
libvips/conversion/tilecache.c
libvips/conversion/sequential.c
libvips/conversion/smartcrop.c
libvips/conversion/premultiply.c
libvips/conversion/scale.c
libvips/conversion/flatten.c
libvips/conversion/conversion.c
libvips/conversion/rot.c
libvips/conversion/sequential.c
libvips/conversion/gamma.c
libvips/conversion/msb.c
libvips/conversion/autorot.c
libvips/conversion/smartcrop.c
libvips/conversion/bandmean.c
libvips/conversion/falsecolour.c
libvips/conversion/byteswap.c
libvips/conversion/subsample.c
libvips/conversion/copy.c
libvips/conversion/tilecache.c
libvips/conversion/extract.c
libvips/conversion/bandbool.c
libvips/conversion/grid.c
libvips/conversion/transpose3d.c
libvips/conversion/unpremultiply.c
libvips/conversion/bandrank.c
libvips/conversion/ifthenelse.c
libvips/conversion/join.c
libvips/conversion/falsecolour.c
libvips/conversion/cache.c
libvips/conversion/embed.c
libvips/conversion/insert.c
libvips/conversion/replicate.c
libvips/conversion/rot45.c
libvips/conversion/byteswap.c
libvips/conversion/bandunfold.c
libvips/conversion/cast.c
libvips/conversion/flip.c
libvips/conversion/zoom.c
libvips/conversion/bandfold.c
libvips/conversion/subsample.c
libvips/conversion/recomb.c
libvips/conversion/bandary.c
libvips/conversion/ifthenelse.c
libvips/conversion/gamma.c
libvips/conversion/join.c
libvips/conversion/cache.c
libvips/conversion/grid.c
libvips/conversion/scale.c
libvips/conversion/insert.c
libvips/conversion/autorot.c
libvips/conversion/rot.c
libvips/conversion/bandrank.c
libvips/convolution/spcor.c
libvips/convolution/conva.c
libvips/convolution/fastcor.c
libvips/convolution/sobel.c
libvips/convolution/canny.c
libvips/convolution/convi.c
libvips/convolution/compass.c
libvips/convolution/convolution.c
libvips/convolution/convf.c
libvips/convolution/correlation.c
libvips/convolution/gaussblur.c
libvips/convolution/convasep.c
libvips/convolution/conv.c
libvips/convolution/convi.c
libvips/convolution/convsep.c
libvips/convolution/sharpen.c
libvips/convolution/conv.c
libvips/convolution/correlation.c
libvips/create/sines.c
libvips/convolution/convolution.c
libvips/convolution/fastcor.c
libvips/convolution/canny.c
libvips/convolution/convf.c
libvips/convolution/spcor.c
libvips/convolution/compass.c
libvips/convolution/convasep.c
libvips/convolution/sobel.c
libvips/create/perlin.c
libvips/create/worley.c
libvips/create/zone.c
libvips/create/mask_ideal_band.c
libvips/create/gaussmat.c
libvips/create/grey.c
libvips/create/mask_ideal.c
libvips/create/buildlut.c
libvips/create/create.c
libvips/create/mask_gaussian.c
libvips/create/fractsurf.c
libvips/create/black.c
libvips/create/xyz.c
libvips/create/invertlut.c
libvips/create/mask_butterworth_ring.c
libvips/create/logmat.c
libvips/create/gaussmat.c
libvips/create/worley.c
libvips/create/mask_gaussian_ring.c
libvips/create/gaussnoise.c
libvips/create/zone.c
libvips/create/tonelut.c
libvips/create/perlin.c
libvips/create/point.c
libvips/create/mask.c
libvips/create/mask_butterworth_band.c
libvips/create/mask_ideal_ring.c
libvips/create/mask_butterworth.c
libvips/create/mask_gaussian_band.c
libvips/create/fractsurf.c
libvips/create/identity.c
libvips/create/mask_ideal_ring.c
libvips/create/point.c
libvips/create/tonelut.c
libvips/create/mask_ideal.c
libvips/create/text.c
libvips/create/mask_fractal.c
libvips/create/mask_butterworth_ring.c
libvips/create/mask_gaussian.c
libvips/create/gaussnoise.c
libvips/create/mask_butterworth_band.c
libvips/create/sines.c
libvips/create/mask_gaussian_ring.c
libvips/create/eye.c
libvips/create/black.c
libvips/create/mask_ideal_band.c
libvips/create/buildlut.c
libvips/draw/draw_line.c
libvips/draw/draw_image.c
libvips/draw/draw_mask.c
libvips/draw/draw.c
libvips/draw/draw_smudge.c
libvips/create/logmat.c
libvips/create/identity.c
libvips/create/mask_gaussian_band.c
libvips/create/mask_fractal.c
libvips/draw/drawink.c
libvips/draw/draw_line.c
libvips/draw/draw_circle.c
libvips/draw/draw_flood.c
libvips/draw/draw_rect.c
libvips/dummy.c
libvips/foreign/foreign.c
libvips/foreign/ppm.c
libvips/foreign/csvsave.c
libvips/foreign/webp2vips.c
libvips/foreign/pngload.c
libvips/foreign/matlab.c
libvips/foreign/webpload.c
libvips/foreign/pngsave.c
libvips/foreign/magicksave.c
libvips/foreign/tiff2vips.c
libvips/foreign/fitsload.c
libvips/foreign/matrixsave.c
libvips/foreign/vips2webp.c
libvips/foreign/tiff.c
libvips/foreign/ppmsave.c
libvips/foreign/csv.c
libvips/foreign/csvload.c
libvips/foreign/vipspng.c
libvips/foreign/vips2jpeg.c
libvips/foreign/ppmload.c
libvips/foreign/magickload.c
libvips/foreign/openexr2vips.c
libvips/foreign/gifload.c
libvips/foreign/magick7load.c
libvips/foreign/openslide2vips.c
libvips/foreign/exif.c
libvips/foreign/pdfiumload.c
libvips/foreign/fitssave.c
libvips/foreign/pdfload.c
libvips/foreign/magick2vips.c
libvips/foreign/fits.c
libvips/foreign/cairo.c
libvips/foreign/openslideload.c
libvips/foreign/rawload.c
libvips/foreign/jpeg2vips.c
libvips/foreign/tiffsave.c
libvips/foreign/svgload.c
libvips/foreign/radsave.c
libvips/foreign/dzsave.c
libvips/foreign/radload.c
libvips/foreign/openexrload.c
libvips/draw/draw_smudge.c
libvips/draw/draw_image.c
libvips/draw/draw_mask.c
libvips/draw/draw.c
libvips/foreign/vipssave.c
libvips/foreign/webpsave.c
libvips/foreign/radiance.c
libvips/foreign/rawsave.c
libvips/foreign/jpegsave.c
libvips/foreign/analyze2vips.c
libvips/foreign/matrixload.c
libvips/foreign/jpegload.c
libvips/foreign/dzsave.c
libvips/foreign/csv.c
libvips/foreign/niftiload.c
libvips/foreign/magick.c
libvips/foreign/analyzeload.c
libvips/foreign/vips2tiff.c
libvips/foreign/matload.c
libvips/foreign/vipsload.c
libvips/foreign/ppmload.c
libvips/foreign/openslideload.c
libvips/foreign/tiffload.c
libvips/freqfilt/spectrum.c
libvips/freqfilt/phasecor.c
libvips/freqfilt/fwfft.c
libvips/freqfilt/freqmult.c
libvips/foreign/tiff2vips.c
libvips/foreign/radsave.c
libvips/foreign/analyze2vips.c
libvips/foreign/fits.c
libvips/foreign/csvsave.c
libvips/foreign/analyzeload.c
libvips/foreign/ppmsave.c
libvips/foreign/radload.c
libvips/foreign/pdfload.c
libvips/foreign/fitssave.c
libvips/foreign/rawload.c
libvips/foreign/heifload.c
libvips/foreign/jpeg2vips.c
libvips/foreign/vips2jpeg.c
libvips/foreign/pdfiumload.c
libvips/foreign/webpsave.c
libvips/foreign/magick7load.c
libvips/foreign/csvload.c
libvips/foreign/heifsave.c
libvips/foreign/radiance.c
libvips/foreign/pngload.c
libvips/foreign/openslide2vips.c
libvips/foreign/matrixsave.c
libvips/foreign/tiffsave.c
libvips/foreign/magickload.c
libvips/foreign/ppm.c
libvips/foreign/jpegsave.c
libvips/foreign/webpload.c
libvips/foreign/gifload.c
libvips/foreign/pngsave.c
libvips/foreign/exif.c
libvips/foreign/magick2vips.c
libvips/foreign/openexr2vips.c
libvips/foreign/matload.c
libvips/foreign/vips2webp.c
libvips/foreign/openexrload.c
libvips/foreign/rawsave.c
libvips/foreign/fitsload.c
libvips/foreign/niftisave.c
libvips/foreign/tiff.c
libvips/foreign/quantise.c
libvips/foreign/webp2vips.c
libvips/foreign/vips2tiff.c
libvips/foreign/cairo.c
libvips/foreign/magicksave.c
libvips/foreign/svgload.c
libvips/foreign/jpegload.c
libvips/foreign/vipsload.c
libvips/foreign/matlab.c
libvips/foreign/foreign.c
libvips/foreign/vipspng.c
libvips/foreign/matrixload.c
libvips/freqfilt/freqfilt.c
libvips/freqfilt/invfft.c
libvips/fuzz/fuzz_new_from_buffer.c
libvips/histogram/hist_match.c
libvips/histogram/hist_cum.c
libvips/histogram/hist_equal.c
libvips/histogram/stdif.c
libvips/histogram/histogram.c
libvips/histogram/hist_entropy.c
libvips/histogram/hist_ismonotonic.c
libvips/freqfilt/freqmult.c
libvips/freqfilt/spectrum.c
libvips/freqfilt/fwfft.c
libvips/freqfilt/phasecor.c
libvips/histogram/hist_norm.c
libvips/histogram/hist_cum.c
libvips/histogram/histogram.c
libvips/histogram/hist_match.c
libvips/histogram/hist_entropy.c
libvips/histogram/hist_plot.c
libvips/histogram/stdif.c
libvips/histogram/percent.c
libvips/histogram/hist_ismonotonic.c
libvips/histogram/hist_equal.c
libvips/histogram/maplut.c
libvips/histogram/hist_unary.c
libvips/histogram/hist_local.c
libvips/histogram/percent.c
libvips/histogram/maplut.c
libvips/introspect.c
libvips/iofuncs/sink.c
libvips/iofuncs/gate.c
libvips/iofuncs/type.c
libvips/iofuncs/image.c
libvips/iofuncs/threadpool.c
libvips/iofuncs/sinkscreen.c
libvips/iofuncs/vipsmarshal.c
libvips/iofuncs/init.c
libvips/iofuncs/dbuf.c
libvips/iofuncs/buffer.c
libvips/iofuncs/mapfile.c
libvips/iofuncs/reorder.c
libvips/iofuncs/enumtypes.c
libvips/iofuncs/sinkdisc.c
libvips/iofuncs/vector.c
libvips/iofuncs/operation.c
libvips/iofuncs/sinkmemory.c
libvips/iofuncs/generate.c
libvips/iofuncs/dbuf.c
libvips/iofuncs/window.c
libvips/iofuncs/system.c
libvips/iofuncs/header.c
libvips/iofuncs/init.c
libvips/iofuncs/rect.c
libvips/iofuncs/region.c
libvips/iofuncs/cache.c
libvips/iofuncs/vips.c
libvips/iofuncs/error.c
libvips/iofuncs/util.c
libvips/iofuncs/semaphore.c
libvips/iofuncs/reorder.c
libvips/iofuncs/base64.c
libvips/iofuncs/memory.c
libvips/iofuncs/sinkscreen.c
libvips/iofuncs/object.c
libvips/iofuncs/sinkdisc.c
libvips/iofuncs/region.c
libvips/iofuncs/rect.c
libvips/iofuncs/util.c
libvips/iofuncs/vips.c
libvips/iofuncs/cache.c
libvips/iofuncs/type.c
libvips/iofuncs/semaphore.c
libvips/iofuncs/gate.c
libvips/iofuncs/mapfile.c
libvips/iofuncs/sink.c
libvips/iofuncs/enumtypes.c
libvips/iofuncs/vector.c
libvips/iofuncs/header.c
libvips/iofuncs/error.c
libvips/iofuncs/generate.c
libvips/iofuncs/image.c
libvips/iofuncs/threadpool.c
libvips/iofuncs/buf.c
libvips/iofuncs/vipsmarshal.c
libvips/morphology/morph.c
libvips/morphology/rank.c
libvips/morphology/countlines.c
libvips/morphology/nearest.c
libvips/iofuncs/system.c
libvips/iofuncs/object.c
libvips/morphology/labelregions.c
libvips/morphology/morph.c
libvips/morphology/nearest.c
libvips/morphology/morphology.c
libvips/morphology/rank.c
libvips/morphology/hitmiss.c
libvips/mosaicing/im_tbmerge.c
libvips/mosaicing/im_improve.c
libvips/mosaicing/im_chkpair.c
libvips/mosaicing/im_lrmosaic.c
libvips/mosaicing/im_tbcalcon.c
libvips/mosaicing/merge.c
libvips/mosaicing/im_remosaic.c
libvips/mosaicing/im_lrcalcon.c
libvips/mosaicing/im_initialize.c
libvips/mosaicing/mosaicing.c
libvips/morphology/countlines.c
libvips/mosaicing/global_balance.c
libvips/mosaicing/im_avgdxdy.c
libvips/mosaicing/im_lrmerge.c
libvips/mosaicing/mosaic.c
libvips/mosaicing/im_tbmosaic.c
libvips/mosaicing/im_clinear.c
libvips/mosaicing/match.c
libvips/mosaicing/im_lrmosaic.c
libvips/mosaicing/im_initialize.c
libvips/mosaicing/im_remosaic.c
libvips/mosaicing/im_improve.c
libvips/mosaicing/im_lrcalcon.c
libvips/mosaicing/mosaic1.c
libvips/resample/affine.c
libvips/resample/shrinkv.c
libvips/resample/mapim.c
libvips/resample/resize.c
libvips/resample/transform.c
libvips/resample/reduce.c
libvips/mosaicing/im_chkpair.c
libvips/mosaicing/im_tbcalcon.c
libvips/mosaicing/mosaicing.c
libvips/mosaicing/mosaic.c
libvips/mosaicing/im_avgdxdy.c
libvips/mosaicing/im_clinear.c
libvips/mosaicing/merge.c
libvips/mosaicing/im_tbmosaic.c
libvips/mosaicing/match.c
libvips/mosaicing/im_lrmerge.c
libvips/mosaicing/im_tbmerge.c
libvips/resample/shrinkh.c
libvips/resample/resample.c
libvips/resample/quadratic.c
libvips/resample/shrinkv.c
libvips/resample/reduce.c
libvips/resample/transform.c
libvips/resample/resize.c
libvips/resample/mapim.c
libvips/resample/thumbnail.c
libvips/resample/shrink.c
libvips/resample/similarity.c
libvips/resample/resample.c
libvips/resample/affine.c
libvips/resample/quadratic.c
libvips/resample/interpolate.c
libvips/resample/similarity.c
libvips/resample/shrink.c
tools/vips.c
tools/vipsedit.c
tools/vipsheader.c
tools/vipsthumbnail.c
cplusplus/include/vips/VImage8.h
cplusplus/include/vips/VInterpolate8.h
cplusplus/include/vips/VError8.h
cplusplus/include/vips/vips-operators.h
libvips/arithmetic/unaryconst.h
libvips/arithmetic/unary.h
libvips/arithmetic/nary.h
cplusplus/include/vips/VImage8.h
cplusplus/include/vips/VInterpolate8.h
libvips/arithmetic/binary.h
libvips/arithmetic/unary.h
libvips/arithmetic/parithmetic.h
libvips/arithmetic/statistic.h
libvips/arithmetic/hough.h
libvips/arithmetic/nary.h
libvips/arithmetic/statistic.h
libvips/arithmetic/unaryconst.h
libvips/colour/profiles.h
libvips/colour/pcolour.h
libvips/conversion/pconversion.h
libvips/conversion/bandary.h
libvips/convolution/pconvolution.h
libvips/conversion/pconversion.h
libvips/convolution/correlation.h
libvips/convolution/pconvolution.h
libvips/create/pmask.h
libvips/create/point.h
libvips/create/pcreate.h
libvips/draw/drawink.h
libvips/create/point.h
libvips/draw/pdraw.h
libvips/foreign/dbh.h
libvips/foreign/pforeign.h
libvips/foreign/magick.h
libvips/draw/drawink.h
libvips/foreign/tiff.h
libvips/foreign/pforeign.h
libvips/foreign/dbh.h
libvips/foreign/magick.h
libvips/foreign/jpeg.h
libvips/freqfilt/pfreqfilt.h
libvips/histogram/hist_unary.h
libvips/histogram/phistogram.h
libvips/include/vips/operation.h
libvips/include/vips/enumtypes.h
libvips/include/vips/video.h
libvips/include/vips/internal.h
libvips/include/vips/histogram.h
libvips/include/vips/cimg_funcs.h
libvips/histogram/hist_unary.h
libvips/include/vips/freqfilt.h
libvips/include/vips/arithmetic.h
libvips/include/vips/buf.h
libvips/include/vips/thread.h
libvips/include/vips/region.h
libvips/include/vips/mask.h
libvips/include/vips/histogram.h
libvips/include/vips/intl.h
libvips/include/vips/threadpool.h
libvips/include/vips/operation.h
libvips/include/vips/video.h
libvips/include/vips/memory.h
libvips/include/vips/conversion.h
libvips/include/vips/private.h
libvips/include/vips/interpolate.h
libvips/include/vips/soname.h
libvips/include/vips/vips7compat.h
libvips/include/vips/create.h
libvips/include/vips/rect.h
libvips/include/vips/internal.h
libvips/include/vips/basic.h
libvips/include/vips/region.h
libvips/include/vips/foreign.h
libvips/include/vips/gate.h
libvips/include/vips/almostdeprecated.h
libvips/include/vips/dispatch.h
libvips/include/vips/version.h
libvips/include/vips/error.h
libvips/include/vips/debug.h
libvips/include/vips/vips.h
libvips/include/vips/morphology.h
libvips/include/vips/resample.h
libvips/include/vips/object.h
libvips/include/vips/generate.h
libvips/include/vips/basic.h
libvips/include/vips/inlines.h
libvips/include/vips/header.h
libvips/include/vips/type.h
libvips/include/vips/semaphore.h
libvips/include/vips/image.h
libvips/include/vips/dbuf.h
libvips/include/vips/vector.h
libvips/include/vips/intl.h
libvips/include/vips/gate.h
libvips/include/vips/freqfilt.h
libvips/include/vips/colour.h
libvips/include/vips/arithmetic.h
libvips/include/vips/threadpool.h
libvips/include/vips/format.h
libvips/include/vips/conversion.h
libvips/include/vips/draw.h
libvips/include/vips/mosaicing.h
libvips/include/vips/deprecated.h
libvips/include/vips/vector.h
libvips/include/vips/cimg_funcs.h
libvips/include/vips/dbuf.h
libvips/include/vips/error.h
libvips/include/vips/type.h
libvips/include/vips/create.h
libvips/include/vips/generate.h
libvips/include/vips/format.h
libvips/include/vips/util.h
libvips/include/vips/convolution.h
libvips/include/vips/foreign.h
libvips/include/vips/thread.h
libvips/include/vips/resample.h
libvips/include/vips/object.h
libvips/include/vips/vips.h
libvips/include/vips/inlines.h
libvips/include/vips/transform.h
libvips/include/vips/memory.h
libvips/include/vips/draw.h
libvips/include/vips/semaphore.h
libvips/include/vips/vips7compat.h
libvips/include/vips/header.h
libvips/include/vips/soname.h
libvips/include/vips/rect.h
libvips/include/vips/colour.h
libvips/include/vips/mask.h
libvips/include/vips/debug.h
libvips/include/vips/morphology.h
libvips/include/vips/enumtypes.h
libvips/include/vips/deprecated.h
libvips/include/vips/version.h
libvips/iofuncs/sink.h
libvips/iofuncs/vipsmarshal.h
libvips/morphology/pmorphology.h
libvips/mosaicing/pmosaicing.h
libvips/mosaicing/global_balance.h
libvips/resample/templates.h
libvips/resample/presample.h
cplusplus/examples/avg.cpp
cplusplus/examples/invert.cpp
cplusplus/examples/profile.cpp
cplusplus/examples/test_overloads.cpp
cplusplus/examples/buffer.cpp
cplusplus/examples/test.cpp
cplusplus/examples/embed.cpp
cplusplus/examples/resize.cpp
libvips/resample/templates.h
cplusplus/VError.cpp
cplusplus/VImage.cpp
cplusplus/VInterpolate.cpp
cplusplus/vips-operators.cpp
libvips/conversion/composite.cpp
libvips/resample/reduceh.cpp
libvips/resample/bicubic.cpp
libvips/resample/vsqbs.cpp
libvips/resample/nohalo.cpp
libvips/resample/lbb.cpp
libvips/resample/nohalo.cpp
libvips/resample/reducev.cpp
libvips/resample/bicubic.cpp

View File

@ -28,34 +28,32 @@ find */* -name "*.cxx" >> po/POTFILES.in
find */* -name "*.cpp" >> po/POTFILES.in
regenerate the list of files to search for strings ... don't forget to
remove autogenerated files (eg. in swig) from the list
you can also remove stuff in 'deprecated'
remove autogenerated files, fuzzer sources, deprecated stuff etc.
intltool-update --pot
make a new vips8.x.pot translation template from the sources
:%s/msgstr ""/msgstr "Malkovich"/
:%s/msgstr\[0\] ""/msgstr[0] "Malkovich"/
:%s/msgstr\[1\] ""/msgstr[1] "Malkovich"/
:g/#, c-format/d
add header
# test translation file
# Copyright (C) 2019
# This file is distributed under the same license as the libvips package.
# John Cupitt <jcupitt@gmail.com>, 2019.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: vips 7.16.0\n"
"Project-Id-Version: vips 8.9.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: Fri Sep 5 10:27:43 BST 2008\n"
"PO-Revision-Date: Fri Sep 5 10:27:43 BST 2008\n"
"POT-Creation-Date: 2019-08-06 15:19+0100\n"
"PO-Revision-Date: 2019-08-06 15:19+0100\n"
"Last-Translator: john <jcupitt@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=s;\n"
edits to make vips8.xx.pot into test.po

1
suppressions/asan.supp Normal file
View File

@ -0,0 +1 @@
interceptor_via_lib:libMagickCore-6.Q16.so

1
suppressions/ubsan.supp Normal file
View File

@ -0,0 +1 @@
undefined:libexif.so

View File

@ -21,9 +21,9 @@ FITS_FILE = os.path.join(IMAGES, "WFPC2u5780205r_c0fx.fits")
OPENSLIDE_FILE = os.path.join(IMAGES, "CMU-1-Small-Region.svs")
PDF_FILE = os.path.join(IMAGES, "ISO_12233-reschart.pdf")
CMYK_PDF_FILE = os.path.join(IMAGES, "cmyktest.pdf")
SVG_FILE = os.path.join(IMAGES, "vips-profile.svg")
SVGZ_FILE = os.path.join(IMAGES, "vips-profile.svgz")
SVG_GZ_FILE = os.path.join(IMAGES, "vips-profile.svg.gz")
SVG_FILE = os.path.join(IMAGES, "logo.svg")
SVGZ_FILE = os.path.join(IMAGES, "logo.svgz")
SVG_GZ_FILE = os.path.join(IMAGES, "logo.svg.gz")
GIF_ANIM_FILE = os.path.join(IMAGES, "cogs.gif")
DICOM_FILE = os.path.join(IMAGES, "dicom_test_image.dcm")
BMP_FILE = os.path.join(IMAGES, "MARBLES.BMP")

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 736 552"
height="552"
width="736"
version="1.1"
id="svg2">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6" />
<path
id="path4138"
d="m 292.55701,403.97015 c -11.55,-6.6492 -21.7875,-12.78153 -22.75,-13.62741 l -1.75,-1.53795 0,-110.29412 0,-110.29412 3.25,-2.39996 c 1.7875,-1.31998 12.16249,-7.46556 23.05553,-13.65685 l 19.80554,-11.25689 2.35848,0.45085 c 3.38665,0.6474 45.32224,24.87039 46.25225,26.7164 0.42801,0.84957 1.0032,15.33435 1.2782,32.18841 l 0.5,30.64374 13.2416,-7.64374 13.2416,-7.64374 0.008,-22.1849 0.008,-22.1849 0.89115,-2.3439 0.89115,-2.34389 21.61628,-12.3613 c 11.88896,-6.79871 22.7123,-12.57081 24.05186,-12.82688 l 2.43557,-0.46559 19.80699,11.26988 c 10.89385,6.19843 21.2695,12.34389 23.057,13.65657 l 3.25,2.38669 0,110.29412 0,110.29412 -1.75,1.53301 c -3.17195,2.77933 -44.15638,25.77697 -45.93672,25.77697 -2.41398,0 -46.05066,-24.9883 -47.02375,-26.92789 -0.4338,-0.86466 -1.01373,-15.38962 -1.28873,-32.27769 l -0.5,-30.70558 -13.25,7.64134 -13.25,7.64133 0,22.26719 0,22.26719 -1.06982,2.348 -1.06982,2.348 -22.1867,12.69906 c -12.20269,6.98448 -23.08377,12.68664 -24.18018,12.67147 -1.09641,-0.0152 -11.44348,-5.46784 -22.99348,-12.11704 z m 36.66752,-10.52924 13.07742,-7.67387 -1.87247,-1.3783 c -2.32846,-1.71395 -24.12972,-14.27397 -24.77627,-14.27397 -0.25977,0 -6.38523,3.42995 -13.61214,7.62211 l -13.13984,7.62211 0.82789,0.76651 c 0.84799,0.78513 25.58999,14.97831 26.12294,14.98537 0.16228,0.002 6.17989,-3.44934 13.37247,-7.66996 z M 431.6602,303.38463 c -0.22923,-0.22923 -6.19622,2.90054 -13.25999,6.95504 l -12.8432,7.37183 -0.2623,31.95164 -0.26229,31.95163 13.26229,7.57763 13.2623,7.57763 0.25999,-46.48431 c 0.14299,-25.56637 0.0724,-46.67186 -0.1568,-46.90109 z m 31.89681,83.96099 10,-5.82586 0.25495,-97.89754 0.25496,-97.89754 -0.77667,-0.77667 -0.77667,-0.77667 -13.22828,7.53761 -13.22829,7.53761 0,22.85232 c 0,12.56877 -0.25005,23.50394 -0.55567,24.30037 -0.30562,0.79643 -26.36178,16.24574 -57.90259,34.33179 -31.5408,18.08605 -57.17657,33.16074 -56.96838,33.49931 0.60109,0.97753 25.30452,14.88442 26.43986,14.88442 0.563,0 9.45284,-4.86996 19.75521,-10.82212 10.30236,-5.95217 27.95657,-16.14861 39.23157,-22.65877 l 20.5,-11.83663 2.73709,-0.008 2.7371,-0.008 2.0129,1.82165 2.01291,1.82166 0,54.86533 0,54.86534 3.75,-1.99197 c 2.0625,-1.09558 8.25,-4.61361 13.75,-7.81783 z m -167.93925,-21.85645 13.43925,-7.6256 0,-23.18327 0,-23.18327 1.25,-1.59478 c 1.03952,-1.32625 47.61139,-28.38858 101.5,-58.98038 6.7375,-3.82479 12.25,-7.3305 12.25,-7.79048 0,-0.95802 -24.25765,-15.01662 -25.91067,-15.01662 -0.59882,0 -16.05138,8.62241 -34.33904,19.1609 -18.28766,10.5385 -36.47479,20.85631 -40.41586,22.92847 l -7.16556,3.76755 -2.01967,-0.52815 c -1.11082,-0.29049 -2.71993,-1.30194 -3.57581,-2.24768 l -1.55614,-1.71951 -0.25863,-54.68424 -0.25862,-54.68423 -13.5,7.75345 -13.5,7.75344 -0.25488,98.75 c -0.14018,54.3125 -3.4e-4,98.75 0.31076,98.75 0.31109,0 6.61329,-3.43152 14.00487,-7.6256 z m 54.42846,-8.1244 -0.0108,-15.75 -13.51373,-7.69805 -13.51372,-7.69804 0.27452,16.07811 0.27452,16.07812 12.5,7.31478 c 6.875,4.02313 12.8375,7.3396 13.25,7.36993 0.4125,0.0303 0.74514,-7.03235 0.73921,-15.69485 z m -12.98921,-110.65695 12.5,-7.32761 0.26354,-31.89276 0.26353,-31.89276 -9.26353,-5.24435 c -5.09495,-2.88438 -11.17604,-6.39287 -13.51354,-7.79663 l -4.25,-2.5523 0,47.05668 c 0,25.88117 0.3375,47.03883 0.75,47.01701 0.4125,-0.0218 6.375,-3.3371 13.25,-7.36728 z m 94.77539,-32.191 -0.27539,-15.59794 -12,-7.00283 c -6.6,-3.85155 -12.5625,-7.23062 -13.25,-7.50904 l -1.25,-0.50622 0.005,15.85699 0.005,15.85699 12.74458,7.23989 c 7.00951,3.98194 13.0935,7.24444 13.51996,7.25 0.42647,0.006 0.65147,-7.00897 0.5,-15.58784 z m 20.92694,-34.96236 c 7.31372,-4.15818 13.29767,-7.72445 13.29767,-7.92505 0,-0.3088 -24.07649,-14.42153 -26.13916,-15.32179 -0.38706,-0.16893 -6.80326,3.18335 -14.25821,7.44952 l -13.55448,7.75668 9.22593,5.38371 c 5.07425,2.96103 11.02592,6.45369 13.22592,7.76145 2.2,1.30776 4.20355,2.39531 4.45233,2.41677 0.24878,0.0215 6.43628,-3.36312 13.75,-7.52129 z"
style="fill:#000000" />
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 297 KiB

View File

@ -388,9 +388,9 @@ class TestForeign:
self.buffer_loader("magickload_buffer", BMP_FILE, bmp_valid)
# we should have rgb or rgba for svg files ... different versions of
# IM handle this differently
# IM handle this differently. GM even gives 1 band.
im = pyvips.Image.magickload(SVG_FILE)
assert im.bands == 3 or im.bands == 4
assert im.bands == 3 or im.bands == 4 or im.bands == 1
# density should change size of generated svg
im = pyvips.Image.magickload(SVG_FILE, density='100')
@ -402,12 +402,10 @@ class TestForeign:
# assert im.width == width * 2
# assert im.height == height * 2
# all-frames should load every frame of the animation
# (though all-frames is deprecated)
im = pyvips.Image.magickload(GIF_ANIM_FILE)
width = im.width
height = im.height
im = pyvips.Image.magickload(GIF_ANIM_FILE, all_frames=True)
im = pyvips.Image.magickload(GIF_ANIM_FILE, n=-1)
assert im.width == width
assert im.height == height * 5
@ -454,10 +452,10 @@ class TestForeign:
assert self.colour.height == x.height
assert self.colour.bands == x.bands
max_diff = (self.colour - x).abs().max()
assert max_diff < 40
assert max_diff < 60
self.save_load_buffer("magicksave_buffer", "magickload_buffer",
self.colour, 40, format="JPG")
self.colour, 60, format="JPG")
# try an animation
if have("gifload"):
@ -473,7 +471,9 @@ class TestForeign:
def test_webp(self):
def webp_valid(im):
a = im(10, 10)
assert_almost_equal_objects(a, [70, 165, 235])
# different webp versions use different rounding systems leading
# to small variations
assert_almost_equal_objects(a, [71, 166, 236], threshold=2)
assert im.width == 550
assert im.height == 368
assert im.bands == 3
@ -656,15 +656,9 @@ class TestForeign:
def test_svgload(self):
def svg_valid(im):
a = im(10, 10)
# some old rsvg versions are way, way off
assert abs(a[0] - 79) < 2
assert abs(a[1] - 79) < 2
assert abs(a[2] - 132) < 2
assert abs(a[3] - 255) < 2
assert im.width == 288
assert im.height == 470
assert_almost_equal_objects(a, [0, 0, 0, 0])
assert im.width == 736
assert im.height == 552
assert im.bands == 4
self.file_loader("svgload", SVG_FILE, svg_valid)