sync fork

This commit is contained in:
Tomáš Szabo 2019-06-30 17:10:56 +02:00
commit 166aae1440
No known key found for this signature in database
GPG Key ID: 96F1E84929851783
4 changed files with 225 additions and 200 deletions

View File

@ -1,5 +1,6 @@
20/6/19 started 8.9.0 20/6/19 started 8.9.0
- add vips_image_get/set_array_int() - add vips_image_get/set_array_int()
- disable webp alpha output if all frame fill the canvas and are solid
24/5/19 started 8.8.1 24/5/19 started 8.8.1
- improve realpath() use on older libc - improve realpath() use on older libc

View File

@ -6,6 +6,8 @@
* 17/2/19 * 17/2/19
* - support ICC, XMP, EXIF, IPTC metadata * - support ICC, XMP, EXIF, IPTC metadata
* - write with a single call to vips_sink_disc() * - write with a single call to vips_sink_disc()
* 29/6/19
* - support "strip" option
*/ */
/* /*
@ -170,7 +172,8 @@ vips_foreign_save_magick_next_image( VipsForeignSaveMagick *magick )
*/ */
image->dispose = BackgroundDispose; image->dispose = BackgroundDispose;
if( magick_set_magick_profile( image, im, magick->exception ) ) { if( !save->strip &&
magick_set_magick_profile( image, im, magick->exception ) ) {
magick_vips_error( class->nickname, magick->exception ); magick_vips_error( class->nickname, magick->exception );
return( -1 ); return( -1 );
} }

View File

@ -20,6 +20,8 @@
* 30/4/19 * 30/4/19
* - deprecate shrink, use scale instead, and make it a double ... this * - deprecate shrink, use scale instead, and make it a double ... this
* lets us do faster and more accurate thumbnailing * lets us do faster and more accurate thumbnailing
* 27/6/19
* - disable alpha output if all frame fill the canvas and are solid
*/ */
/* /*
@ -97,17 +99,22 @@ typedef struct {
*/ */
double scale; double scale;
/* Size of each frame in input image coordinates.
*/
int canvas_width;
int canvas_height;
/* Size of each frame, in scaled output image coordinates,
*/
int frame_width;
int frame_height;
/* Size of final output image. /* Size of final output image.
*/ */
int width; int width;
int height; int height;
/* Size of each frame. /* TRUE if we will save the final image as RGBA.
*/
int frame_width;
int frame_height;
/* TRUE for RGBA.
*/ */
int alpha; int alpha;
@ -418,8 +425,6 @@ static int
read_header( Read *read, VipsImage *out ) read_header( Read *read, VipsImage *out )
{ {
WebPData data; WebPData data;
int canvas_width;
int canvas_height;
int flags; int flags;
int i; int i;
@ -430,16 +435,19 @@ read_header( Read *read, VipsImage *out )
return( -1 ); return( -1 );
} }
canvas_width = WebPDemuxGetI( read->demux, WEBP_FF_CANVAS_WIDTH ); read->canvas_width =
canvas_height = WebPDemuxGetI( read->demux, WEBP_FF_CANVAS_HEIGHT ); WebPDemuxGetI( read->demux, WEBP_FF_CANVAS_WIDTH );
read->canvas_height =
WebPDemuxGetI( read->demux, WEBP_FF_CANVAS_HEIGHT );
/* We round-to-nearest cf. pdfload etc. /* We round-to-nearest cf. pdfload etc.
*/ */
read->frame_width = VIPS_RINT( canvas_width * read->scale ); read->frame_width = VIPS_RINT( read->canvas_width * read->scale );
read->frame_height = VIPS_RINT( canvas_height * read->scale ); read->frame_height = VIPS_RINT( read->canvas_height * read->scale );
#ifdef DEBUG #ifdef DEBUG
printf( "webp2vips: canvas_width = %d\n", canvas_width ); printf( "webp2vips: canvas_width = %d\n", read->canvas_width );
printf( "webp2vips: canvas_height = %d\n", canvas_height ); printf( "webp2vips: canvas_height = %d\n", read->canvas_height );
printf( "webp2vips: frame_width = %d\n", read->frame_width ); printf( "webp2vips: frame_width = %d\n", read->frame_width );
printf( "webp2vips: frame_height = %d\n", read->frame_height ); printf( "webp2vips: frame_height = %d\n", read->frame_height );
#endif /*DEBUG*/ #endif /*DEBUG*/
@ -494,6 +502,19 @@ read_header( Read *read, VipsImage *out )
*/ */
vips_image_set_int( out, "gif-delay", vips_image_set_int( out, "gif-delay",
VIPS_RINT( read->delays[0] / 10.0 ) ); VIPS_RINT( read->delays[0] / 10.0 ) );
/* We need the alpha in an animation if:
* - any frame has transparent pixels
* - any frame doesn't fill the whole canvas.
*/
do {
if( iter.has_alpha ||
iter.width != read->canvas_width ||
iter.height != read->canvas_height ) {
read->alpha = TRUE;
break;
}
} while( WebPDemuxNextFrame( &iter ) );
} }
WebPDemuxReleaseIterator( &iter ); WebPDemuxReleaseIterator( &iter );