From 07cf2be29e51d7e0aeb495b43987772229dad203 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 14 Feb 2012 10:53:39 +0000 Subject: [PATCH] fix png save --- TODO | 11 ++++++++--- libvips/foreign/vipspng.c | 10 +++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 8660b3ce..cc4b6ec6 100644 --- a/TODO +++ b/TODO @@ -9,9 +9,7 @@ `gdouble' is invalid or out of range for property `yres' of type `gdouble' -- png save from nip2 often makes bad pngs? - - and clicking on one of those bad pngs in the file browser will lock nip2 +- clicking on bad pngs in the file browser will lock nip2 they don't seem to bother "header" though, strange @@ -44,6 +42,13 @@ total of about 0.5s user time difference + ... tile size difference! + + try + + time ./vips.py wtc_tiled_small.tif x.tif --vips-tile-width=512 + --vips-tile-height=512 + diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index 96ee6a2b..95f8bd27 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -513,13 +513,19 @@ typedef struct { } Write; static void -write_destroy( VipsImage *out, Write *write ) +write_finish( Write *write ) { VIPS_FREEF( fclose, write->fp ); if( write->pPng ) png_destroy_write_struct( &write->pPng, &write->pInfo ); } +static void +write_destroy( VipsImage *out, Write *write ) +{ + write_finish( write ); +} + static Write * write_new( VipsImage *in ) { @@ -690,6 +696,8 @@ vips__png_write( VipsImage *in, const char *filename, return( -1 ); } + write_finish( write ); + return( 0 ); }