commit fa7884198a9a31b0ad49fe93393e99c7ef673e9c
parent b6183dd722b9cae9ceba5ae3522194541bb04c28
Author: Jack Mordaunt <jackmordaunt@gmail.com>
Date: Sun, 11 Feb 2018 16:07:05 +0100
[+] Moved to fluent API. Image format is now passed to the encoder.
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/cmd/icnsify/main.go b/cmd/icnsify/main.go
@@ -50,15 +50,14 @@ func main() {
defer outputf.Close()
output = outputf
}
- img, _, err := image.Decode(input)
+ img, format, err := image.Decode(input)
if err != nil {
log.Fatalf("decoding image: %v", err)
}
- if err := icns.EncodeWithInterpolationFunction(
- output,
- img,
- algorithm,
- ); err != nil {
+ enc := icns.NewEncoder(output, img).
+ WithAlgorithm(algorithm).
+ WithFormat(format)
+ if err := enc.Encode(); err != nil {
log.Fatalf("encoding icns: %v", err)
}
}