Browse Source

Fix smart crop + brur/sharpen SIGSEGV on Alpine

DarthSim 6 years ago
parent
commit
e163400864
1 changed files with 5 additions and 0 deletions
  1. 5 0
      process.go

+ 5 - 0
process.go

@@ -324,6 +324,11 @@ func processImage(ctx context.Context) ([]byte, error) {
 			if err = vipsSmartCrop(&img, po.Width, po.Height); err != nil {
 			if err = vipsSmartCrop(&img, po.Width, po.Height); err != nil {
 				return nil, err
 				return nil, err
 			}
 			}
+			// Applying additional modifications after smart crop causes SIGSEGV on Alpine
+			// so we have to copy memory after it
+			if err = vipsImageCopyMemory(&img); err != nil {
+				return nil, err
+			}
 		} else {
 		} else {
 			left, top := calcCrop(imgWidth, imgHeight, po)
 			left, top := calcCrop(imgWidth, imgHeight, po)
 			if err = vipsCrop(&img, left, top, po.Width, po.Height); err != nil {
 			if err = vipsCrop(&img, left, top, po.Width, po.Height); err != nil {