diff --git a/ChangeLog b/ChangeLog
index 74e1191e..4a79488f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,7 @@
- vipsthumbnail has selectable interpolators, optional sharpen
- moved a lot of stuff (eg. im_iscomplex()) from deprecated to
almostdeprecated to avoid breakage
+- im_vips2tiff has a bigtiff option
15/1/10 started 7.21.1
- added "written" callbacks, used to implement write to non-vips formats
diff --git a/libvips/format/im_magick2vips.c b/libvips/format/im_magick2vips.c
index fdf54b25..c9e6e6a9 100644
--- a/libvips/format/im_magick2vips.c
+++ b/libvips/format/im_magick2vips.c
@@ -240,6 +240,21 @@ parse_header( Read *read )
Image *p;
int i;
+ printf( "GetImageChannelDepth(DefaultChannels) = %ld\n",
+ GetImageChannelDepth( image, DefaultChannels, &image->exception ) );
+ printf( "GetImageDepth() = %ld\n",
+ GetImageDepth( image, &image->exception ) );
+ printf( "GetImageQuantumDepth(MagickFalse) = %ld\n",
+ GetImageQuantumDepth( image, MagickFalse ) );
+ printf( "GetImageType() = %d\n",
+ GetImageType( image, &image->exception ) );
+ printf( "IsGrayImage() = %d\n",
+ IsGrayImage( image, &image->exception ) );
+ printf( "IsMonochromeImage() = %d\n",
+ IsMonochromeImage( image, &image->exception ) );
+ printf( "IsOpaqueImage() = %d\n",
+ IsOpaqueImage( image, &image->exception ) );
+
im->Xsize = image->columns;
im->Ysize = image->rows;
read->frame_height = image->rows;
diff --git a/libvips/format/im_vips2tiff.c b/libvips/format/im_vips2tiff.c
index fe43bba9..9edc0c9c 100644
--- a/libvips/format/im_vips2tiff.c
+++ b/libvips/format/im_vips2tiff.c
@@ -108,6 +108,8 @@
* - trigger eval callbacks during tile write
* 4/2/10
* - gtkdoc
+ * 26/2/10
+ * - option to turn on bigtiff output
*/
/*
@@ -249,6 +251,7 @@ typedef struct tiff_write {
float yres; /* Resolution in Y */
int embed; /* Embed ICC profile */
char *icc_profile; /* Profile to embed */
+ int bigtiff; /* True for bigtiff write */
} TiffWrite;
/* Use these from im_tiff2vips().
@@ -259,11 +262,16 @@ void im__thandler_warning( char *module, char *fmt, va_list ap );
/* Open TIFF for output.
*/
static TIFF *
-tiff_openout( const char *name )
+tiff_openout( TiffWrite *tw, const char *name )
{
TIFF *tif;
+ const char *mode = tw->bigtiff ? "w8" : "w";
- if( !(tif = TIFFOpen( name, "w" )) ) {
+#ifdef DEBUG
+ printf( "TIFFOpen( \"%s\", \"%s\" )\n", name, mode );
+#endif /*DEBUG*/
+
+ if( !(tif = TIFFOpen( name, mode )) ) {
im_error( "im_vips2tiff",
_( "unable to open \"%s\" for output" ), name );
return( NULL );
@@ -653,7 +661,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above,
/* Make output image.
*/
- if( !(layer->tif = tiff_openout( layer->lname )) )
+ if( !(layer->tif = tiff_openout( tw, layer->lname )) )
return( -1 );
/* Write the TIFF header for this layer.
@@ -1219,6 +1227,7 @@ make_tiff_write( IMAGE *im, const char *filename )
tw->onebit = 0;
tw->embed = 0;
tw->icc_profile = NULL;
+ tw->bigtiff = 0;
/* Output resolution settings ... default to VIPS-alike.
*/
@@ -1384,6 +1393,9 @@ make_tiff_write( IMAGE *im, const char *filename )
tw->embed = 1;
tw->icc_profile = im_strdup( NULL, q );
}
+ if( (q = im_getnextoption( &p )) && strcmp( q, "8" ) == 0 ) {
+ tw->bigtiff = 1;
+ }
if( (q = im_getnextoption( &p )) ) {
im_error( "im_vips2tiff",
_( "unknown extra options \"%s\"" ), q );
@@ -1546,7 +1558,7 @@ gather_pyramid( TiffWrite *tw )
printf( "Starting pyramid gather ...\n" );
#endif /*DEBUG*/
- if( !(out = tiff_openout( tw->name )) )
+ if( !(out = tiff_openout( tw, tw->name )) )
return( -1 );
if( tiff_append( tw, out, tw->bname ) ) {
@@ -1580,7 +1592,7 @@ gather_pyramid( TiffWrite *tw )
* You can embed options in the filename. They have the form:
*
* |[
- * filename.tif:compression,layout,multi-res,format,resolution,icc
+ * filename.tif:compression,layout,multi-res,format,resolution,icc, bigtiff
* ]|
*
*
@@ -1656,6 +1668,13 @@ gather_pyramid( TiffWrite *tw )
* they are tagged.
*
*
+ *
+ *
+ * bigtiff
+ * Set this to 8 to enable bigtiff output. Bigtiff is a variant of the TIFF
+ * format that allows more than 4GB in a file.
+ *
+ *
*
*
* Example:
@@ -1725,7 +1744,7 @@ im_vips2tiff( IMAGE *in, const char *filename )
return( -1 );
if( tw->pyramid ) {
if( !(tw->bname = new_tiff_name( tw, tw->name, 1 )) ||
- !(tw->tif = tiff_openout( tw->bname )) ) {
+ !(tw->tif = tiff_openout( tw, tw->bname )) ) {
free_tiff_write( tw );
return( -1 );
}
@@ -1733,7 +1752,7 @@ im_vips2tiff( IMAGE *in, const char *filename )
else {
/* No pyramid ... write straight to name.
*/
- if( !(tw->tif = tiff_openout( tw->name )) ) {
+ if( !(tw->tif = tiff_openout( tw, tw->name )) ) {
free_tiff_write( tw );
return( -1 );
}