SoFunction
Updated on 2025-03-03

The process of Golang using Imagick7 in Window environment

Install msys2

  • Download and installhttps:///
  • Execute the following command in msys2
pacman -Syuu
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-pkg-config
pacman -S mingw-w64-x86_64-zlib
pacman -S mingw-w64-x86_64-imagemagick

Configure environment variables

set PATH=c:\msys64\mingw64\bin;%PATH%
set PKG_CONFIG_PATH=c:\msys64\mingw64\lib\pkgconfig
set MAGICK_CODER_MODULE_PATH=c:\msys64\mingw64\lib\ImageMagick-7.0.6\modules-Q16HDRI\coders
  • msys64 needs to be modified according to the installation addressc:\msys64\mingw64
  • ImageMagick-7.0.6 needs to be modified according to the installation version

Extended Compilation

go build /gographics/imagick.v3/imagick
pkg-config --cflags --libs MagickWand
go get -u /gographics/imagick.v3/imagick

Sample code

package main
import "/gographics/imagick.v3/imagick"
func main() {
	()
	defer ()
	mw1 := ()
	defer ()
	("./")
	(100, 100, imagick.FILTER_LANCZOS)
	("./human_resize.jpg")
}

This is the article about Golang using Imagick7 in the Window environment. For more information about Golang using Imagick7, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!