Skip to content
Snippets Groups Projects
Commit 29d0648e authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Improved imagick error

parent 6dd37c08
Branches
Tags
No related merge requests found
......@@ -39,7 +39,6 @@ func processImage(config *Config, client *redis.Client, value string) {
errorChannel := make(chan error)
wand := imagick.NewMagickWand()
defer wand.Destroy()
err := wand.ReadImage(filepath.Join(config.SourceFolder, image.Id))
if err != nil {
......@@ -47,7 +46,6 @@ func processImage(config *Config, client *redis.Client, value string) {
}
wandLinear := wand.Clone()
defer wand.Clear()
err = wandLinear.TransformImageColorspace(imagick.COLORSPACE_RGB)
if err != nil {
panic(err)
......@@ -81,6 +79,9 @@ func processImage(config *Config, client *redis.Client, value string) {
Success: true,
})
}
wand.Clear()
wandLinear.Clear()
}
func main() {
......
......@@ -10,7 +10,6 @@ import (
func resize(wand *imagick.MagickWand, wandLinear *imagick.MagickWand, size Size, quality Quality, target string) error {
var err error
var mw *imagick.MagickWand
defer mw.Clear()
if size.Width == 0 && size.Height == 0 {
mw = wand.Clone()
......@@ -91,5 +90,8 @@ func resize(wand *imagick.MagickWand, wandLinear *imagick.MagickWand, size Size,
mw.StripImage()
err = mw.WriteImage(target)
mw.Clear()
return err
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment