Merge branch 'master' into add-icc-fallbacks
This commit is contained in:
commit
a93deb8201
@ -12,6 +12,7 @@
|
|||||||
- don't stop composite on first non-transparent image [felixbuenemann, GDmac]
|
- don't stop composite on first non-transparent image [felixbuenemann, GDmac]
|
||||||
- add vips_rect_overlapsrect()
|
- add vips_rect_overlapsrect()
|
||||||
- composite is much faster at positioning subimages
|
- composite is much faster at positioning subimages
|
||||||
|
- dzsave has a new skip_blanks option
|
||||||
- add CMYK as a supported colourspace
|
- add CMYK as a supported colourspace
|
||||||
|
|
||||||
21/11/18 started 8.7.3
|
21/11/18 started 8.7.3
|
||||||
|
@ -37,12 +37,13 @@
|
|||||||
#endif /*HAVE_CONFIG_H*/
|
#endif /*HAVE_CONFIG_H*/
|
||||||
#include <vips/intl.h>
|
#include <vips/intl.h>
|
||||||
|
|
||||||
|
#include <vips/vips.h>
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
#ifdef HAVE_LCMS2
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <vips/vips.h>
|
|
||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
|
|
||||||
#include "profiles.h"
|
#include "profiles.h"
|
||||||
|
@ -37,12 +37,13 @@
|
|||||||
#endif /*HAVE_CONFIG_H*/
|
#endif /*HAVE_CONFIG_H*/
|
||||||
#include <vips/intl.h>
|
#include <vips/intl.h>
|
||||||
|
|
||||||
|
#include <vips/vips.h>
|
||||||
|
|
||||||
#ifdef HAVE_LCMS2
|
#ifdef HAVE_LCMS2
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <vips/vips.h>
|
|
||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
|
|
||||||
#include "pcolour.h"
|
#include "pcolour.h"
|
||||||
|
@ -76,6 +76,8 @@
|
|||||||
* 24/11/17
|
* 24/11/17
|
||||||
* - output overlap-only tiles on edges for better deepzoom spec
|
* - output overlap-only tiles on edges for better deepzoom spec
|
||||||
* compliance
|
* compliance
|
||||||
|
* 19/12/18
|
||||||
|
* - add @skip_blanks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -448,6 +450,7 @@ struct _VipsForeignSaveDz {
|
|||||||
VipsForeignDzContainer container;
|
VipsForeignDzContainer container;
|
||||||
int compression;
|
int compression;
|
||||||
VipsRegionShrink region_shrink;
|
VipsRegionShrink region_shrink;
|
||||||
|
int skip_blanks;
|
||||||
|
|
||||||
/* Tile and overlap geometry. The members above are the parameters we
|
/* Tile and overlap geometry. The members above are the parameters we
|
||||||
* accept, this next set are the derived values which are actually
|
* accept, this next set are the derived values which are actually
|
||||||
@ -1044,14 +1047,14 @@ tile_name( Layer *layer, int x, int y )
|
|||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test for tile equal to background colour. In google maps mode, we skip
|
/* Test for tile nearly equal to background colour. In google maps mode, we
|
||||||
* blank background tiles.
|
* skip blank background tiles.
|
||||||
*
|
*
|
||||||
* Don't use exactly equality, since compression artefacts or noise can upset
|
* Don't use exactly equality since compression artefacts or noise can upset
|
||||||
* this.
|
* this.
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
tile_equal( VipsImage *image, VipsPel * restrict ink )
|
tile_equal( VipsImage *image, int threshold, VipsPel * restrict ink )
|
||||||
{
|
{
|
||||||
const int bytes = VIPS_IMAGE_SIZEOF_PEL( image );
|
const int bytes = VIPS_IMAGE_SIZEOF_PEL( image );
|
||||||
|
|
||||||
@ -1077,7 +1080,7 @@ tile_equal( VipsImage *image, VipsPel * restrict ink )
|
|||||||
|
|
||||||
for( x = 0; x < image->Xsize; x++ ) {
|
for( x = 0; x < image->Xsize; x++ ) {
|
||||||
for( b = 0; b < bytes; b++ )
|
for( b = 0; b < bytes; b++ )
|
||||||
if( VIPS_ABS( p[b] - ink[b] ) > 5 ) {
|
if( VIPS_ABS( p[b] - ink[b] ) > threshold ) {
|
||||||
g_object_unref( region );
|
g_object_unref( region );
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@ -1166,11 +1169,8 @@ strip_work( VipsThreadState *state, void *a )
|
|||||||
state->pos.width, state->pos.height, NULL ) )
|
state->pos.width, state->pos.height, NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* If we are writing a google map pyramid and the tile is equal to the
|
if( dz->skip_blanks >= 0 &&
|
||||||
* background, don't save. The viewer will display blank.png for us.
|
tile_equal( x, dz->skip_blanks, dz->ink ) ) {
|
||||||
*/
|
|
||||||
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE &&
|
|
||||||
tile_equal( x, dz->ink ) ) {
|
|
||||||
g_object_unref( x );
|
g_object_unref( x );
|
||||||
|
|
||||||
#ifdef DEBUG_VERBOSE
|
#ifdef DEBUG_VERBOSE
|
||||||
@ -1631,6 +1631,12 @@ vips_foreign_save_dz_build( VipsObject *object )
|
|||||||
dz->tile_size = 256;
|
dz->tile_size = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* skip_blanks defaults to 5 in google mode.
|
||||||
|
*/
|
||||||
|
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE &&
|
||||||
|
!vips_object_argument_isset( object, "skip_blanks" ) )
|
||||||
|
dz->skip_blanks = 5;
|
||||||
|
|
||||||
/* Our tile layout.
|
/* Our tile layout.
|
||||||
*/
|
*/
|
||||||
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_DZ ) {
|
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_DZ ) {
|
||||||
@ -1650,8 +1656,7 @@ vips_foreign_save_dz_build( VipsObject *object )
|
|||||||
/* Default to white background. vips_foreign_save_init() defaults to
|
/* Default to white background. vips_foreign_save_init() defaults to
|
||||||
* black.
|
* black.
|
||||||
*/
|
*/
|
||||||
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE &&
|
if( !vips_object_argument_isset( object, "background" ) ) {
|
||||||
!vips_object_argument_isset( object, "background" ) ) {
|
|
||||||
VipsArrayDouble *background;
|
VipsArrayDouble *background;
|
||||||
|
|
||||||
/* Using g_object_set() to set an input param in build will
|
/* Using g_object_set() to set an input param in build will
|
||||||
@ -1690,9 +1695,9 @@ vips_foreign_save_dz_build( VipsObject *object )
|
|||||||
save->ready = z;
|
save->ready = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We use ink in google mode to check for blank tiles.
|
/* We use ink to check for blank tiles.
|
||||||
*/
|
*/
|
||||||
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE ) {
|
if( dz->skip_blanks >= 0 ) {
|
||||||
if( !(dz->ink = vips__vector_to_ink(
|
if( !(dz->ink = vips__vector_to_ink(
|
||||||
class->nickname, save->ready,
|
class->nickname, save->ready,
|
||||||
VIPS_AREA( save->background )->data, NULL,
|
VIPS_AREA( save->background )->data, NULL,
|
||||||
@ -2105,6 +2110,13 @@ vips_foreign_save_dz_class_init( VipsForeignSaveDzClass *class )
|
|||||||
G_STRUCT_OFFSET( VipsForeignSaveDz, region_shrink ),
|
G_STRUCT_OFFSET( VipsForeignSaveDz, region_shrink ),
|
||||||
VIPS_TYPE_REGION_SHRINK, VIPS_REGION_SHRINK_MEAN );
|
VIPS_TYPE_REGION_SHRINK, VIPS_REGION_SHRINK_MEAN );
|
||||||
|
|
||||||
|
VIPS_ARG_INT( class, "skip_blanks", 19,
|
||||||
|
_( "Skip blanks" ),
|
||||||
|
_( "Skip tiles which are nearly equal to the background" ),
|
||||||
|
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||||
|
G_STRUCT_OFFSET( VipsForeignSaveDz, skip_blanks ),
|
||||||
|
-1, 65535, -1 );
|
||||||
|
|
||||||
/* How annoying. We stupidly had these in earlier versions.
|
/* How annoying. We stupidly had these in earlier versions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -2144,6 +2156,7 @@ vips_foreign_save_dz_init( VipsForeignSaveDz *dz )
|
|||||||
dz->container = VIPS_FOREIGN_DZ_CONTAINER_FS;
|
dz->container = VIPS_FOREIGN_DZ_CONTAINER_FS;
|
||||||
dz->compression = 0;
|
dz->compression = 0;
|
||||||
dz->region_shrink = VIPS_REGION_SHRINK_MEAN;
|
dz->region_shrink = VIPS_REGION_SHRINK_MEAN;
|
||||||
|
dz->skip_blanks = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct _VipsForeignSaveDzFile {
|
typedef struct _VipsForeignSaveDzFile {
|
||||||
@ -2340,7 +2353,8 @@ vips_foreign_save_dz_buffer_init( VipsForeignSaveDzBuffer *buffer )
|
|||||||
* * @container: #VipsForeignDzContainer set container type
|
* * @container: #VipsForeignDzContainer set container type
|
||||||
* * @properties: %gboolean write a properties file
|
* * @properties: %gboolean write a properties file
|
||||||
* * @compression: %gint zip deflate compression level
|
* * @compression: %gint zip deflate compression level
|
||||||
* * @shrink_region: #VipsRegionShrink How to shrink each 2x2 region.
|
* * @region_shrink: #VipsRegionShrink how to shrink each 2x2 region
|
||||||
|
* * @skip_blanks: %gint skip tiles which are nearly equal to the background
|
||||||
*
|
*
|
||||||
* Save an image as a set of tiles at various resolutions. By default dzsave
|
* Save an image as a set of tiles at various resolutions. By default dzsave
|
||||||
* uses DeepZoom layout -- use @layout to pick other conventions.
|
* uses DeepZoom layout -- use @layout to pick other conventions.
|
||||||
@ -2388,6 +2402,11 @@ vips_foreign_save_dz_buffer_init( VipsForeignSaveDzBuffer *buffer )
|
|||||||
* region. This defaults to using the average of the 4 input pixels but you can
|
* region. This defaults to using the average of the 4 input pixels but you can
|
||||||
* also use the median in cases where you want to preserve the range of values.
|
* also use the median in cases where you want to preserve the range of values.
|
||||||
*
|
*
|
||||||
|
* If you set @skip_blanks to a value greater than or equal to zero, tiles
|
||||||
|
* which are all within that many pixel values to the background are skipped.
|
||||||
|
* This can save a lot of space for some image types. This option defaults to
|
||||||
|
* 5 in Google layout mode, -1 otherwise.
|
||||||
|
*
|
||||||
* See also: vips_tiffsave().
|
* See also: vips_tiffsave().
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, -1 on error.
|
* Returns: 0 on success, -1 on error.
|
||||||
@ -2426,7 +2445,8 @@ vips_dzsave( VipsImage *in, const char *name, ... )
|
|||||||
* * @container: #VipsForeignDzContainer set container type
|
* * @container: #VipsForeignDzContainer set container type
|
||||||
* * @properties: %gboolean write a properties file
|
* * @properties: %gboolean write a properties file
|
||||||
* * @compression: %gint zip deflate compression level
|
* * @compression: %gint zip deflate compression level
|
||||||
* * @shrink_region: #VipsRegionShrink How to shrink each 2x2 region.
|
* * @region_shrink: #VipsRegionShrink how to shrink each 2x2 region.
|
||||||
|
* * @skip_blanks: %gint skip tiles which are nearly equal to the background
|
||||||
*
|
*
|
||||||
* As vips_dzsave(), but save to a memory buffer.
|
* As vips_dzsave(), but save to a memory buffer.
|
||||||
*
|
*
|
||||||
|
@ -490,6 +490,11 @@ png2vips_header( Read *read, VipsImage *out )
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Attach original palette bit depth, if any, as metadata.
|
||||||
|
*/
|
||||||
|
if( color_type == PNG_COLOR_TYPE_PALETTE )
|
||||||
|
vips_image_set_int( out, "palette-bit-depth", bit_depth );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user