Exemple #1
0
// make-tile creates a tileable image from an input image.
// ( +clone -flop ) +append  ( +clone -flip ) -append -resize 50%
func make_tile(mw *imagick.MagickWand, outfile string) {
	mwc := mw.Clone()
	mwc.FlopImage()
	mw.AddImage(mwc)
	mwc.Destroy()
	mwc = mw.AppendImages(false)
	mwf := mwc.Clone()
	mwf.FlipImage()
	mwc.AddImage(mwf)
	mwf.Destroy()
	mwf = mwc.AppendImages(true)

	w := mwf.GetImageWidth()
	h := mwf.GetImageHeight()
	// 1 = Don't blur or sharpen image
	mwf.ResizeImage(w/2, h/2, imagick.FILTER_LANCZOS, 1)
	mwf.WriteImage(outfile)
	mwf.Destroy()
	mwc.Destroy()
}