Skip to content

Commit

Permalink
Merge branch '295_MagickAutoThresholdImage' into im-7
Browse files Browse the repository at this point in the history
# Conflicts:
#	imagick/magick_wand_image.go
  • Loading branch information
justinfx committed Sep 16, 2023
2 parents 17dfe96 + cb104ac commit 2c85e18
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

ARG IMAGEMAGICK_PROJECT=ImageMagick
ARG IMAGEMAGICK_VERSION=7.0.8-11
ARG IMAGEMAGICK_VERSION=7.0.8-41
ENV IMAGEMAGICK_VERSION=$IMAGEMAGICK_VERSION

RUN cd && \
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Go Imagick is a Go bind to ImageMagick's MagickWand C API.
We support two compatibility branches:

```
im-7 (tag v3.x.x): 7.x <= ImageMagick <= 7.x
master (tag v2.x.x): 6.9.1-7 <= ImageMagick <= 6.9.9-35
legacy (tag v1.x.x): 6.7.x <= ImageMagick <= 6.8.9-10
im-7 (tag v3.x.x): 7.0.8-41 <= ImageMagick <= 7.x
master (tag v2.x.x): 6.9.1-7 <= ImageMagick <= 6.9.9-35
legacy (tag v1.x.x): 6.7.x <= ImageMagick <= 6.8.9-10
```

They map, respectively, through gopkg.in:
Expand Down
11 changes: 11 additions & 0 deletions imagick/magick_wand_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -2289,6 +2289,17 @@ func (mw *MagickWand) AutoOrientImage() error {
return mw.getLastErrorIfFailed(ok)
}

// AutoThresholdImage automatically performs image thresholding
// dependent on which method you specify.
//
// A description of each parameter follows:
//
// method: choose from Kapur, OTSU, or Triangle.
func (mw *MagickWand) AutoThresholdImage(method AutoThresholdMethodType) error {
ok := C.MagickAutoThresholdImage(mw.mw, C.AutoThresholdMethod(method))
return mw.getLastErrorIfFailed(ok)
}

// SetImagePage Sets the page geometry of the image.
func (mw *MagickWand) SetImagePage(width, height uint, x, y int) error {
ok := C.MagickSetImagePage(mw.mw, C.size_t(width), C.size_t(height), C.ssize_t(x), C.ssize_t(y))
Expand Down
19 changes: 19 additions & 0 deletions imagick/threshold_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2013 Herbert G. Fischer. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package imagick

/*
#include <MagickWand/MagickWand.h>
*/
import "C"

type AutoThresholdMethodType int

const (
AUTO_THRESHOLD_METHOD_UNDEFINED AutoThresholdMethodType = C.UndefinedThresholdMethod
AUTO_THRESHOLD_METHOD_KAPUR AutoThresholdMethodType = C.KapurThresholdMethod
AUTO_THRESHOLD_METHOD_OTSU AutoThresholdMethodType = C.OTSUThresholdMethod
AUTO_THRESHOLD_METHOD_TRIANGLE AutoThresholdMethodType = C.TriangleThresholdMethod
)

0 comments on commit 2c85e18

Please sign in to comment.