How to change adaptiveThresholdImage output color?

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
pocakka
Posts: 2
Joined: 2016-12-14T02:51:44-07:00
Authentication code: 1151

How to change adaptiveThresholdImage output color?

Post by pocakka » 2016-12-14T03:06:02-07:00

Hi,

How can I change or replace to "adaptiveThresholdImage" output colors?
I use this code: http://phpimagick.com/Imagick/adaptiveThresholdImage

I made a picture with PS, what I need via adaptiveThresholdImage:

Image

Regards :)

User avatar
fmw42
Posts: 22105
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to change adaptiveThresholdImage output color?

Post by fmw42 » 2016-12-14T09:43:39-07:00

What is your IM version and platform? Please always provide that, since syntax may differ.

Is your After example what is produced from adaptiveThreshold or what you want it to be after changing the colors from the Before image? Which is the result from adaptive threshold and is the Before, the original before using adaptivethreshold?

What colors do you want changed?

Please clarify.

pocakka
Posts: 2
Joined: 2016-12-14T02:51:44-07:00
Authentication code: 1151

Re: How to change adaptiveThresholdImage output color?

Post by pocakka » 2016-12-14T10:01:45-07:00

I use Imagick with Centos 7 (and Cpanel).

This is my phpinfo:

Image

I want to change the black output color to grey. I use now the original code:

Code: Select all

function adaptiveThresholdImage($imagePath, $width, $height, $adaptiveOffset)
{
    $imagick = new \Imagick(realpath($imagePath));
    $adaptiveOffsetQuantum = intval($adaptiveOffset * \Imagick::getQuantum());
    $imagick->adaptiveThresholdImage($width, $height, $adaptiveOffsetQuantum);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}

User avatar
fmw42
Posts: 22105
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to change adaptiveThresholdImage output color?

Post by fmw42 » 2016-12-14T13:12:17-07:00

see Imagick::paintOpaqueImage

Post Reply