From 970ba8cfcc84d83c65687acd64192b3f9121b7b2 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 2 Dec 2020 07:35:36 +0000 Subject: [PATCH] don't add date in ppmsave if @strip is set see https://github.com/libvips/libvips/issues/1913 --- libvips/foreign/ppmsave.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libvips/foreign/ppmsave.c b/libvips/foreign/ppmsave.c index ae39c26a..47560ce8 100644 --- a/libvips/foreign/ppmsave.c +++ b/libvips/foreign/ppmsave.c @@ -10,6 +10,8 @@ * - add ppmsave_target * 20/11/20 * - byteswap on save, if necessary [ewelot] + * 2/12/20 + * - don't add date with @strip [ewelot] */ /* @@ -212,6 +214,8 @@ vips_foreign_save_ppm_block( VipsRegion *region, VipsRect *area, void *a ) static int vips_foreign_save_ppm( VipsForeignSavePpm *ppm, VipsImage *image ) { + VipsForeignSave *save = (VipsForeignSave *) ppm; + char *magic; char *date; @@ -245,11 +249,13 @@ vips_foreign_save_ppm( VipsForeignSavePpm *ppm, VipsImage *image ) else g_assert_not_reached(); - vips_target_writef( ppm->target, "%s\n", magic ); - date = vips__get_iso8601(); - vips_target_writef( ppm->target, - "#vips2ppm - %s\n", date ); - g_free( date ); + if( !save->strip ) { + vips_target_writef( ppm->target, "%s\n", magic ); + date = vips__get_iso8601(); + vips_target_writef( ppm->target, + "#vips2ppm - %s\n", date ); + g_free( date ); + } vips_target_writef( ppm->target, "%d %d\n", image->Xsize, image->Ysize );