Translate CLI ImageMagick to Magick++: threshold and depth
问题 I am converting a system call to Magick++ in my code, but I am having some trouble converting the threshold and depth . The original: convert /foo/bar.ppm -crop WxH+X+Y -threshold 50% -depth 1 /foo/out.ppm My current C++ version is: Magick::InitializeMagick(*argv); Magick::Image img; img.read("/foo/bar.ppm"); Magick::Image temp_img(img); temp_img.chop(Magick::Geometry(X,Y); temp_img.crop(Magick::Geometry(W,H)); temp_img.threshold(.50); temp_img.depth(1); temp_img.write("/foo/out.ppm"); The