From f89ced23e49a834f2e7c40862597d24774416396 Mon Sep 17 00:00:00 2001 From: DarthSim Date: Fri, 6 Jan 2023 16:36:52 +0300 Subject: [PATCH] Speedup processing --- processing/scale.go | 6 +----- vips/vips.c | 27 ++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/processing/scale.go b/processing/scale.go index 07ac3cc3..ce85cbaa 100644 --- a/processing/scale.go +++ b/processing/scale.go @@ -16,9 +16,5 @@ func scale(pctx *pipelineContext, img *vips.Image, po *options.ProcessingOptions wscale, hscale = hscale, wscale } - if err := img.Resize(wscale, hscale); err != nil { - return err - } - - return img.CopyMemory() + return img.Resize(wscale, hscale) } diff --git a/vips/vips.c b/vips/vips.c index a999c95f..253e240b 100644 --- a/vips/vips.c +++ b/vips/vips.c @@ -597,13 +597,30 @@ vips_strip(VipsImage *in, VipsImage **out, int keep_exif_copyright) { for (int i = 0; fields[i] != NULL; i++) { gchar *name = fields[i]; - if (strcmp(name, VIPS_META_ICC_NAME) == 0) continue; - if (strcmp(name, "palette-bit-depth") == 0) continue; + if ( + (strcmp(name, VIPS_META_ICC_NAME) == 0) || + (strcmp(name, "palette-bit-depth") == 0) || + (strcmp(name, "width") == 0) || + (strcmp(name, "height") == 0) || + (strcmp(name, "bands") == 0) || + (strcmp(name, "format") == 0) || + (strcmp(name, "coding") == 0) || + (strcmp(name, "interpretation") == 0) || + (strcmp(name, "xoffset") == 0) || + (strcmp(name, "yoffset") == 0) || + (strcmp(name, "xres") == 0) || + (strcmp(name, "yres") == 0) || + (strcmp(name, "vips-loader") == 0) || + (strcmp(name, "background") == 0) || + (strcmp(name, "vips-sequential") == 0) + ) continue; if (keep_exif_copyright) { - if (strcmp(name, VIPS_META_EXIF_NAME) == 0) continue; - if (strcmp(name, "exif-ifd0-Copyright") == 0) continue; - if (strcmp(name, "exif-ifd0-Artist") == 0) continue; + if ( + (strcmp(name, VIPS_META_EXIF_NAME) == 0) || + (strcmp(name, "exif-ifd0-Copyright") == 0) || + (strcmp(name, "exif-ifd0-Artist") == 0) + ) continue; } vips_image_remove(*out, name);