mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-18 11:12:10 +02:00
Save BMP as JPEG by default
This commit is contained in:
parent
aa5ce8be8d
commit
1274010010
@ -20,6 +20,12 @@ func imageTypeSaveSupport(imgtype imageType) bool {
|
|||||||
return imgtype == imageTypeSVG || vipsTypeSupportSave[imgtype]
|
return imgtype == imageTypeSVG || vipsTypeSupportSave[imgtype]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func imageTypeGoodForWeb(imgtype imageType) bool {
|
||||||
|
return imgtype != imageTypeHEIC &&
|
||||||
|
imgtype != imageTypeTIFF &&
|
||||||
|
imgtype != imageTypeBMP
|
||||||
|
}
|
||||||
|
|
||||||
func extractMeta(img *vipsImage) (int, int, int, bool) {
|
func extractMeta(img *vipsImage) (int, int, int, bool) {
|
||||||
width := img.Width()
|
width := img.Width()
|
||||||
height := img.Height()
|
height := img.Height()
|
||||||
@ -557,7 +563,7 @@ func processImage(ctx context.Context) ([]byte, context.CancelFunc, error) {
|
|||||||
switch {
|
switch {
|
||||||
case po.PreferWebP && imageTypeSaveSupport(imageTypeWEBP):
|
case po.PreferWebP && imageTypeSaveSupport(imageTypeWEBP):
|
||||||
po.Format = imageTypeWEBP
|
po.Format = imageTypeWEBP
|
||||||
case imageTypeSaveSupport(imgdata.Type) && imgdata.Type != imageTypeHEIC && imgdata.Type != imageTypeTIFF:
|
case imageTypeSaveSupport(imgdata.Type) && imageTypeGoodForWeb(imgdata.Type):
|
||||||
po.Format = imgdata.Type
|
po.Format = imgdata.Type
|
||||||
default:
|
default:
|
||||||
po.Format = imageTypeJPEG
|
po.Format = imageTypeJPEG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user