mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-02-07 11:36:25 +02:00
Convert all images to uchar
This commit is contained in:
parent
dc2c23c01a
commit
bdbb496c18
24
process.go
24
process.go
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user