@@ -33,6 +33,7 @@ const (
33
33
"CONVERT_TYPES": ["webp"],
34
34
"STRIP_METADATA": true,
35
35
"ENABLE_EXTRA_PARAMS": false,
36
+ "EXTRA_PARAMS_CROP_INTERESTING": "InterestingAttention",
36
37
"READ_BUFFER_SIZE": 4096,
37
38
"CONCURRENCY": 262144,
38
39
"DISABLE_KEEPALIVE": false,
49
50
ProxyMode bool
50
51
Prefetch bool
51
52
Config = NewWebPConfig ()
52
- Version = "0.11.1 "
53
+ Version = "0.11.2 "
53
54
WriteLock = cache .New (5 * time .Minute , 10 * time .Minute )
54
55
ConvertLock = cache .New (5 * time .Minute , 10 * time .Minute )
55
56
RemoteRaw = "./remote-raw"
@@ -78,12 +79,14 @@ type WebpConfig struct {
78
79
EnableAVIF bool `json:"ENABLE_AVIF"`
79
80
EnableJXL bool `json:"ENABLE_JXL"`
80
81
81
- EnableExtraParams bool `json:"ENABLE_EXTRA_PARAMS"`
82
- StripMetadata bool `json:"STRIP_METADATA"`
83
- ReadBufferSize int `json:"READ_BUFFER_SIZE"`
84
- Concurrency int `json:"CONCURRENCY"`
85
- DisableKeepalive bool `json:"DISABLE_KEEPALIVE"`
86
- CacheTTL int `json:"CACHE_TTL"`
82
+ EnableExtraParams bool `json:"ENABLE_EXTRA_PARAMS"`
83
+ ExtraParamsCropInteresting string `json:"EXTRA_PARAMS_CROP_INTERESTING"`
84
+
85
+ StripMetadata bool `json:"STRIP_METADATA"`
86
+ ReadBufferSize int `json:"READ_BUFFER_SIZE"`
87
+ Concurrency int `json:"CONCURRENCY"`
88
+ DisableKeepalive bool `json:"DISABLE_KEEPALIVE"`
89
+ CacheTTL int `json:"CACHE_TTL"`
87
90
}
88
91
89
92
func NewWebPConfig () * WebpConfig {
@@ -101,12 +104,13 @@ func NewWebPConfig() *WebpConfig {
101
104
EnableAVIF : false ,
102
105
EnableJXL : false ,
103
106
104
- EnableExtraParams : false ,
105
- StripMetadata : true ,
106
- ReadBufferSize : 4096 ,
107
- Concurrency : 262144 ,
108
- DisableKeepalive : false ,
109
- CacheTTL : 259200 ,
107
+ EnableExtraParams : false ,
108
+ ExtraParamsCropInteresting : "InterestingAttention" ,
109
+ StripMetadata : true ,
110
+ ReadBufferSize : 4096 ,
111
+ Concurrency : 262144 ,
112
+ DisableKeepalive : false ,
113
+ CacheTTL : 259200 ,
110
114
}
111
115
}
112
116
@@ -191,6 +195,15 @@ func LoadConfig() {
191
195
log .Warnf ("WEBP_ENABLE_EXTRA_PARAMS is not a valid boolean, using value in config.json %t" , Config .EnableExtraParams )
192
196
}
193
197
}
198
+ if os .Getenv ("WEBP_EXTRA_PARAMS_CROP_INTERESTING" ) != "" {
199
+ availableInteresting := []string {"InterestingNone" , "InterestingEntropy" , "InterestingCentre" , "InterestingAttention" , "InterestringLow" , "InterestingHigh" , "InterestingAll" }
200
+ if slices .Contains (availableInteresting , os .Getenv ("WEBP_EXTRA_PARAMS_CROP_INTERESTING" )) {
201
+ Config .ExtraParamsCropInteresting = os .Getenv ("WEBP_EXTRA_PARAMS_CROP_INTERESTING" )
202
+ } else {
203
+ log .Warnf ("WEBP_EXTRA_PARAMS_CROP_INTERESTING is not a valid interesting, using value in config.json %s" , Config .ExtraParamsCropInteresting )
204
+ }
205
+ }
206
+
194
207
if os .Getenv ("WEBP_STRIP_METADATA" ) != "" {
195
208
stripMetadata := os .Getenv ("WEBP_STRIP_METADATA" )
196
209
if stripMetadata == "true" {
0 commit comments