Browse Source

Copy image before smart crop

DarthSim 7 years ago
parent
commit
168efd16bb
1 changed files with 3 additions and 0 deletions
  1. 3 0
      vips.h

+ 3 - 0
vips.h

@@ -140,6 +140,9 @@ vips_process_image(VipsImage **img, gboolean resize, double scale, gboolean crop
   if (crop) {
     if (smart) {
       #if VIPS_SUPPORT_SMARTCROP
+      if (!(tmp = vips_image_copy_memory(*img))) return 1;
+      swap_and_clear(img, tmp);
+
       if (vips_smartcrop(*img, &tmp, width, height, NULL)) return 1;
       swap_and_clear(img, tmp);
       #endif