From 7072c85e4e1f7166599aa5778a36d442e0361d76 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sun, 17 Dec 2017 00:03:26 +0100 Subject: [PATCH] Added method to set the gif properties of the image. --- libvips/foreign/magick2vips.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libvips/foreign/magick2vips.c b/libvips/foreign/magick2vips.c index e3d54f80..26941db1 100644 --- a/libvips/foreign/magick2vips.c +++ b/libvips/foreign/magick2vips.c @@ -1035,6 +1035,23 @@ write_new( VipsImage *im, const char *filename, const char *format ) #ifdef HAVE_MAGICK7 +static int +magick_set_properties( Write *write ) +{ + int number; + const char *str; + + if( !vips_image_get_int( write->im, "gif-delay", &number ) ) + write->current_image->delay = (size_t) number; + + if( !vips_image_get_int( write->im, "gif-loop", &number ) ) + write->current_image->iterations = (size_t) number; + + if( !vips_image_get_string( write->im, "gif-comment", &str ) ) + (void) SetImageProperty( write->current_image, "comment", + str, write->exception ); +} + static int magick_write_block( VipsRegion *region, VipsRect *area, void *a ) { @@ -1076,6 +1093,7 @@ magick_create_image( Write *write, VipsImage *im ) return( -1 ); write->current_image=image; + magick_set_properties( write ); return( vips_sink_disc( im, magick_write_block, write ) ); }