|
@@ -501,7 +501,15 @@ func transformImage(ctx context.Context, img *vipsImage, data []byte, po *proces
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return img.RgbColourspace()
|
|
|
+ if err = img.RgbColourspace(); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ if err := img.CastUchar(); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ return copyMemoryAndCheckTimeout(ctx, img)
|
|
|
}
|
|
|
|
|
|
func transformAnimated(ctx context.Context, img *vipsImage, data []byte, po *processingOptions, imgtype imageType) error {
|
|
@@ -599,6 +607,14 @@ func transformAnimated(ctx context.Context, img *vipsImage, data []byte, po *pro
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if err = img.CastUchar(); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ if err = copyMemoryAndCheckTimeout(ctx, img); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
img.SetInt("page-height", frames[0].Height())
|
|
|
img.SetInt("gif-delay", delay)
|
|
|
img.SetInt("gif-loop", loop)
|
|
@@ -769,12 +785,6 @@ func processImage(ctx context.Context) ([]byte, context.CancelFunc, error) {
|
|
|
return nil, func() {}, err
|
|
|
}
|
|
|
|
|
|
- if po.Format == imageTypeGIF || po.Format == imageTypeBMP {
|
|
|
- if err := img.CastUchar(); err != nil {
|
|
|
- return nil, func() {}, err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if po.MaxBytes > 0 && canFitToBytes(po.Format) {
|
|
|
return saveImageToFitBytes(po, img)
|
|
|
}
|