1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-11-29 23:07:40 +02:00

Fix sizes of GIF and ICO before save

This commit is contained in:
DarthSim
2022-07-18 18:49:40 +06:00
parent f368ed13e9
commit 97e15c717d
6 changed files with 110 additions and 36 deletions

View File

@@ -31,6 +31,8 @@ type Image struct {
var (
typeSupportLoad sync.Map
typeSupportSave sync.Map
gifResolutionLimit int
)
var vipsConf struct {
@@ -69,6 +71,8 @@ func Init() error {
C.vips_cache_set_trace(C.gboolean(1))
}
gifResolutionLimit = int(C.gif_resolution_limit())
vipsConf.JpegProgressive = gbool(config.JpegProgressive)
vipsConf.PngInterlaced = gbool(config.PngInterlaced)
vipsConf.PngQuantize = gbool(config.PngQuantize)
@@ -183,6 +187,10 @@ func SupportsSave(it imagetype.Type) bool {
return sup
}
func GifResolutionLimit() int {
return gifResolutionLimit
}
func gbool(b bool) C.gboolean {
if b {
return C.gboolean(1)