Skip to content

Commit 00f696f

Browse files
authored
allow speed from get (#383)
* allow speed from get * updating the version to use effor param in libvips
1 parent e96c018 commit 00f696f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

options.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type ImageOptions struct {
4444
Color []uint8
4545
Background []uint8
4646
Interlace bool
47+
Speed int
4748
Extend bimg.Extend
4849
Gravity bimg.Gravity
4950
Colorspace bimg.Interpretation
@@ -144,6 +145,7 @@ func BimgOptions(o ImageOptions) bimg.Options {
144145
Rotate: bimg.Angle(o.Rotate),
145146
Interlace: o.Interlace,
146147
Palette: o.Palette,
148+
Speed: o.Speed,
147149
}
148150

149151
if len(o.Background) != 0 {

params.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ var paramTypeCoercions = map[string]Coercion{
5656
"interlace": coerceInterlace,
5757
"aspectratio": coerceAspectRatio,
5858
"palette": coercePalette,
59+
"speed": coerceSpeed,
5960
}
6061

6162
func coerceTypeInt(param interface{}) (int, error) {
@@ -350,6 +351,11 @@ func coercePalette(io *ImageOptions, param interface{}) (err error) {
350351
return err
351352
}
352353

354+
func coerceSpeed(io *ImageOptions, param interface{}) (err error) {
355+
io.Speed, err = coerceTypeInt(param)
356+
return err
357+
}
358+
353359
func buildParamsFromOperation(op PipelineOperation) (ImageOptions, error) {
354360
var options ImageOptions
355361

0 commit comments

Comments
 (0)