Code: Select all
bool Imagick::setFormat ( string $format )
The following code used to work in the past (older version of ImageMagick... don't remember which one), but it's not working anymore in the current environment:
Code: Select all
private function monochrome() {
if (isset($this->image)) {
try {
// reduce image colors to 2 (black and white)
$this->image->quantizeImage(2, Imagick::COLORSPACE_GRAY, 5, false, true);
// reduce image depth to 1 bit per pixel
$this->image->setImageDepth(1);
$this->image->setImageChannelDepth(Imagick::CHANNEL_ALL, 1);
// set image type to monochrome (2 colors: black and white only)
$this->image->setImageType(Imagick::IMGTYPE_BILEVEL);
}
catch (ImagickException $ie) {
throw $ie;
}
}
else {
throw new Exception("No image object");
}
}
I also tried:
Code: Select all
$this->image->setImageColorSpace(Imagick::COLORSPACE_GRAY);
My goal is to generate the smallest possible, black and white, bitmap image for a signature capture application. I know there are better image formats than bitmap, but the generated image has to be compatible with the old Access 97. That is why 'bmp2' is the choice for the image format.
Any ideas? Thanks!