add a subifd flag to tiffsave
This commit is contained in:
parent
5549175b5e
commit
7deead8911
@ -63,7 +63,8 @@ int vips__tiff_write( VipsImage *in, const char *filename,
|
|||||||
VipsRegionShrink region_shrink,
|
VipsRegionShrink region_shrink,
|
||||||
int level,
|
int level,
|
||||||
gboolean lossless,
|
gboolean lossless,
|
||||||
VipsForeignDzDepth depth );
|
VipsForeignDzDepth depth,
|
||||||
|
gboolean subifd );
|
||||||
|
|
||||||
int vips__tiff_write_buf( VipsImage *in,
|
int vips__tiff_write_buf( VipsImage *in,
|
||||||
void **obuf, size_t *olen,
|
void **obuf, size_t *olen,
|
||||||
@ -81,7 +82,8 @@ int vips__tiff_write_buf( VipsImage *in,
|
|||||||
VipsRegionShrink region_shrink,
|
VipsRegionShrink region_shrink,
|
||||||
int level,
|
int level,
|
||||||
gboolean lossless,
|
gboolean lossless,
|
||||||
VipsForeignDzDepth depth );
|
VipsForeignDzDepth depth,
|
||||||
|
gboolean subifd );
|
||||||
|
|
||||||
gboolean vips__istiff_source( VipsSource *source );
|
gboolean vips__istiff_source( VipsSource *source );
|
||||||
gboolean vips__istifftiled_source( VipsSource *source );
|
gboolean vips__istifftiled_source( VipsSource *source );
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
* - xres/yres params were in pixels/cm
|
* - xres/yres params were in pixels/cm
|
||||||
* 26/1/20
|
* 26/1/20
|
||||||
* - add "depth" to set pyr depth
|
* - add "depth" to set pyr depth
|
||||||
|
* 12/5/20
|
||||||
|
* - add "subifd" to create pyr layers as sub-directories
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -98,6 +100,8 @@ typedef struct _VipsForeignSaveTiff {
|
|||||||
int level;
|
int level;
|
||||||
gboolean lossless;
|
gboolean lossless;
|
||||||
VipsForeignDzDepth depth;
|
VipsForeignDzDepth depth;
|
||||||
|
gboolean subifd;
|
||||||
|
|
||||||
} VipsForeignSaveTiff;
|
} VipsForeignSaveTiff;
|
||||||
|
|
||||||
typedef VipsForeignSaveClass VipsForeignSaveTiffClass;
|
typedef VipsForeignSaveClass VipsForeignSaveTiffClass;
|
||||||
@ -327,7 +331,7 @@ vips_foreign_save_tiff_class_init( VipsForeignSaveTiffClass *class )
|
|||||||
1, 22, 10 );
|
1, 22, 10 );
|
||||||
|
|
||||||
VIPS_ARG_BOOL( class, "lossless", 24,
|
VIPS_ARG_BOOL( class, "lossless", 24,
|
||||||
_( "lossless" ),
|
_( "Lossless" ),
|
||||||
_( "Enable WEBP lossless mode" ),
|
_( "Enable WEBP lossless mode" ),
|
||||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||||
G_STRUCT_OFFSET( VipsForeignSaveTiff, lossless ),
|
G_STRUCT_OFFSET( VipsForeignSaveTiff, lossless ),
|
||||||
@ -340,6 +344,13 @@ vips_foreign_save_tiff_class_init( VipsForeignSaveTiffClass *class )
|
|||||||
G_STRUCT_OFFSET( VipsForeignSaveTiff, depth ),
|
G_STRUCT_OFFSET( VipsForeignSaveTiff, depth ),
|
||||||
VIPS_TYPE_FOREIGN_DZ_DEPTH, VIPS_FOREIGN_DZ_DEPTH_ONETILE );
|
VIPS_TYPE_FOREIGN_DZ_DEPTH, VIPS_FOREIGN_DZ_DEPTH_ONETILE );
|
||||||
|
|
||||||
|
VIPS_ARG_BOOL( class, "subifd", 24,
|
||||||
|
_( "Sub-IFD" ),
|
||||||
|
_( "Save pyr layers as sub-IFDs" ),
|
||||||
|
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||||
|
G_STRUCT_OFFSET( VipsForeignSaveTiff, subifd ),
|
||||||
|
FALSE );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -396,7 +407,8 @@ vips_foreign_save_tiff_file_build( VipsObject *object )
|
|||||||
tiff->region_shrink,
|
tiff->region_shrink,
|
||||||
tiff->level,
|
tiff->level,
|
||||||
tiff->lossless,
|
tiff->lossless,
|
||||||
tiff->depth ) )
|
tiff->depth,
|
||||||
|
tiff->subifd ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
@ -468,7 +480,8 @@ vips_foreign_save_tiff_buffer_build( VipsObject *object )
|
|||||||
tiff->region_shrink,
|
tiff->region_shrink,
|
||||||
tiff->level,
|
tiff->level,
|
||||||
tiff->lossless,
|
tiff->lossless,
|
||||||
tiff->depth ) )
|
tiff->depth,
|
||||||
|
tiff->subifd ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* vips__tiff_write_buf() makes a buffer that needs g_free(), not
|
/* vips__tiff_write_buf() makes a buffer that needs g_free(), not
|
||||||
@ -537,6 +550,7 @@ vips_foreign_save_tiff_buffer_init( VipsForeignSaveTiffBuffer *buffer )
|
|||||||
* * @level: %gint, Zstd compression level
|
* * @level: %gint, Zstd compression level
|
||||||
* * @lossless: %gboolean, WebP losssless mode
|
* * @lossless: %gboolean, WebP losssless mode
|
||||||
* * @depth: #VipsForeignDzDepth how deep to make the pyramid
|
* * @depth: #VipsForeignDzDepth how deep to make the pyramid
|
||||||
|
* * @subifd: %gboolean write pyr layers as sub-ifds
|
||||||
*
|
*
|
||||||
* Write a VIPS image to a file as TIFF.
|
* Write a VIPS image to a file as TIFF.
|
||||||
*
|
*
|
||||||
@ -620,6 +634,10 @@ vips_foreign_save_tiff_buffer_init( VipsForeignSaveTiffBuffer *buffer )
|
|||||||
* #VIPS_META_PHOTOSHOP_NAME (if set) is used to set the value of the PHOTOSHOP
|
* #VIPS_META_PHOTOSHOP_NAME (if set) is used to set the value of the PHOTOSHOP
|
||||||
* tag.
|
* tag.
|
||||||
*
|
*
|
||||||
|
* By default, pyramid layers are saved as consecutive pages.
|
||||||
|
* Set @subifd to save pyramid layers as sub-directories of the main image.
|
||||||
|
* Setting this option can improve compatibility with formats like OME.
|
||||||
|
*
|
||||||
* See also: vips_tiffload(), vips_image_write_to_file().
|
* See also: vips_tiffload(), vips_image_write_to_file().
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, -1 on error.
|
* Returns: 0 on success, -1 on error.
|
||||||
@ -665,6 +683,7 @@ vips_tiffsave( VipsImage *in, const char *filename, ... )
|
|||||||
* * @level: %gint, Zstd compression level
|
* * @level: %gint, Zstd compression level
|
||||||
* * @lossless: %gboolean, WebP losssless mode
|
* * @lossless: %gboolean, WebP losssless mode
|
||||||
* * @depth: #VipsForeignDzDepth how deep to make the pyramid
|
* * @depth: #VipsForeignDzDepth how deep to make the pyramid
|
||||||
|
* * @subifd: %gboolean write pyr layers as sub-ifds
|
||||||
*
|
*
|
||||||
* As vips_tiffsave(), but save to a memory buffer.
|
* As vips_tiffsave(), but save to a memory buffer.
|
||||||
*
|
*
|
||||||
|
@ -334,6 +334,7 @@ struct _Wtiff {
|
|||||||
int level; /* zstd compression level */
|
int level; /* zstd compression level */
|
||||||
gboolean lossless; /* webp lossless mode */
|
gboolean lossless; /* webp lossless mode */
|
||||||
VipsForeignDzDepth depth; /* Pyr depth */
|
VipsForeignDzDepth depth; /* Pyr depth */
|
||||||
|
gboolean subifd; /* Write pyr layers into subifds */
|
||||||
|
|
||||||
/* True if we've detected a toilet-roll image, plus the page height,
|
/* True if we've detected a toilet-roll image, plus the page height,
|
||||||
* which has been checked to be a factor of im->Ysize. page_number
|
* which has been checked to be a factor of im->Ysize. page_number
|
||||||
@ -1858,7 +1859,7 @@ wtiff_copy_tiff( Wtiff *wtiff, TIFF *out, TIFF *in )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append all of the lower layers we wrote to the output.
|
/* Append all of the layers we wrote to the output.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
wtiff_gather( Wtiff *wtiff )
|
wtiff_gather( Wtiff *wtiff )
|
||||||
@ -1999,7 +2000,8 @@ vips__tiff_write( VipsImage *input, const char *filename,
|
|||||||
VipsRegionShrink region_shrink,
|
VipsRegionShrink region_shrink,
|
||||||
int level,
|
int level,
|
||||||
gboolean lossless,
|
gboolean lossless,
|
||||||
VipsForeignDzDepth depth )
|
VipsForeignDzDepth depth,
|
||||||
|
gboolean subifd )
|
||||||
{
|
{
|
||||||
Wtiff *wtiff;
|
Wtiff *wtiff;
|
||||||
|
|
||||||
@ -2043,7 +2045,8 @@ vips__tiff_write_buf( VipsImage *input,
|
|||||||
VipsRegionShrink region_shrink,
|
VipsRegionShrink region_shrink,
|
||||||
int level,
|
int level,
|
||||||
gboolean lossless,
|
gboolean lossless,
|
||||||
VipsForeignDzDepth depth )
|
VipsForeignDzDepth depth,
|
||||||
|
gboolean subifd )
|
||||||
{
|
{
|
||||||
Wtiff *wtiff;
|
Wtiff *wtiff;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user