Merge branch 'magicksave' of https://github.com/dlemstra/libvips into dlemstra-magicksave

This commit is contained in:
John Cupitt 2017-12-23 12:39:50 +00:00
commit e12df167e6
5 changed files with 39 additions and 16 deletions

View File

@ -1,3 +1,6 @@
23/12/17 started 8.7.0
- add magicksave, save image with libMagick [dlemstra]
10/12/17 started 8.6.1
- stop window new/free cycling .. faster zoom out on large images in nip2
- fix some compiler warnings

View File

@ -2,7 +2,7 @@
# also update the version number in the m4 macros below
AC_INIT([vips], [8.6.1], [vipsip@jiscmail.ac.uk])
AC_INIT([vips], [8.7.0], [vipsip@jiscmail.ac.uk])
# required for gobject-introspection
AC_PREREQ(2.62)
@ -17,8 +17,8 @@ AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [8])
m4_define([vips_minor_version], [6])
m4_define([vips_micro_version], [1])
m4_define([vips_minor_version], [7])
m4_define([vips_micro_version], [0])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
@ -37,9 +37,9 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date -u -r ChangeLog`
# binary interface changes backwards compatible?: increment age
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=50
LIBRARY_REVISION=1
LIBRARY_AGE=8
LIBRARY_CURRENT=51
LIBRARY_REVISION=0
LIBRARY_AGE=9
# patched into include/vips/version.h
AC_SUBST(VIPS_VERSION)

View File

@ -82,6 +82,13 @@ magick_set_property( Image *image, const char *property, const char *value,
(void) SetImageProperty( image, property, value, exception );
}
int
magick_set_image_colorspace( Image *image, const ColorspaceType colorspace,
ExceptionInfo *exception)
{
return( SetImageColorspace( image, colorspace, exception ) );
}
void
magick_inherit_exception( ExceptionInfo *exception, Image *image )
{
@ -109,7 +116,7 @@ magick_genesis( void )
VIPS_ONCE( &once, magick_genesis_cb, NULL );
}
#endif /*HAVE_MAGICK7 */
#endif /*HAVE_MAGICK7*/
#ifdef HAVE_MAGICK
@ -154,13 +161,20 @@ magick_set_property( Image *image, const char *property, const char *value,
(void) SetImageProperty( image, property, value );
}
int
magick_set_image_colorspace( Image *image, const ColorspaceType colorspace,
ExceptionInfo *exception )
{
(void) exception;
return( SetImageColorspace( image, colorspace ) );
}
void
magick_inherit_exception( ExceptionInfo *exception, Image *image )
{
InheritException( exception, &image->exception );
}
static void *
magick_genesis_cb( void *client )
{
@ -185,4 +199,4 @@ magick_genesis( void )
VIPS_ONCE( &once, magick_genesis_cb, NULL );
}
#endif /*HAVE_MAGICK */
#endif /*HAVE_MAGICK*/

View File

@ -53,6 +53,8 @@ int magick_import_pixels( Image *image, const ssize_t x, const ssize_t y,
const StorageType type,const void *pixels, ExceptionInfo *exception );
void magick_set_property( Image *image, const char *property, const char *value,
ExceptionInfo *exception );
int magick_set_image_colorspace( Image *image, const ColorspaceType colorspace,
ExceptionInfo *exception );
void magick_inherit_exception( ExceptionInfo *exception, Image *image );
void magick_genesis( void );

View File

@ -92,23 +92,22 @@ vips_foreign_save_magick_dispose( GObject *gobject )
static void
vips_foreign_save_magick_set_properties( VipsForeignSaveMagick *magick,
VipsImage *im )
Image *image, VipsImage *im )
{
int number;
const char *str;
if( vips_image_get_typeof( im, "gif-delay" ) &&
!vips_image_get_int( im, "gif-delay", &number ) )
magick->current_image->delay = (size_t) number;
image->delay = (size_t) number;
if( vips_image_get_typeof( im, "gif-loop" ) &&
!vips_image_get_int( im, "gif-loop", &number ) )
magick->current_image->iterations = (size_t) number;
image->iterations = (size_t) number;
if( vips_image_get_typeof( im, "gif-comment" ) &&
!vips_image_get_string( im, "gif-comment", &str ) )
magick_set_property( magick->current_image, "comment",
str, magick->exception );
magick_set_property( image, "comment", str, magick->exception );
}
static int
@ -157,11 +156,16 @@ vips_foreign_save_magick_create_one( VipsForeignSaveMagick *magick,
if( !magick_set_image_size( image, im->Xsize, im->Ysize,
magick->exception ) )
return( -1 );
if( im->Bands < 3 )
if( !magick_set_image_colorspace( image, GRAYColorspace,
magick->exception ) )
return( -1 );
vips_foreign_save_magick_set_properties( magick, image, im );
magick->current_image = image;
vips_foreign_save_magick_set_properties( magick, im );
status = vips_sink_disc( im, magick_write_block, magick );
magick_inherit_exception( magick->exception, magick->current_image );
magick_inherit_exception( magick->exception, image );
return( status );
}