You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We run a custom server & app with ImageMagick 3.7.
Because of our version, check_imagick() defaults to GD - line 980 in current Image Watermark, version 1.7.3.
This is a problem, because GD causes a color shift in the watermarked images.
So adjusting the version check would help us.
Aditionally, also in check_imagick(), some of the methods in our version of Imagick / Imagemagic come out camel-cased.
array_map('strtolower', get_class_methods('Imagick') resolves that.
Lastly, it looks like the watermark can "pollute" the color space and/or color profiles of the result.
This seems to help:
// copy color space from original image to watermark
$watermark->transformImageColorspace( $image->getColorspace() );
// remove existing color profiles from the watermark image
$watermark->stripImage();
// copy all color profiles from the original image to the watermark
$profiles = $image->getImageProfiles('*', false);
foreach ($profiles as $profile) {
$profileData = $image->getImageProfile($profile);
$watermark->profileImage($profile, $profileData);
}
I can do a pull request for all that if you are interested.
The text was updated successfully, but these errors were encountered:
In addition to @thartl's description, I am also using 3.7.0 in local development and examing the IW, I found that the checking method get_class_methods() is not actually reliable. In actual instantiation of Imagick class, writeimage and getimage are actually exist. get_class_methods() does not reflect all kinds of methods.
To comprehensively do a deep test, use reflection instead:
We run a custom server & app with ImageMagick 3.7.
Because of our version, check_imagick() defaults to GD - line 980 in current Image Watermark, version 1.7.3.
This is a problem, because GD causes a color shift in the watermarked images.
So adjusting the version check would help us.
Aditionally, also in check_imagick(), some of the methods in our version of Imagick / Imagemagic come out camel-cased.
array_map('strtolower', get_class_methods('Imagick') resolves that.
Lastly, it looks like the watermark can "pollute" the color space and/or color profiles of the result.
This seems to help:
// copy color space from original image to watermark
$watermark->transformImageColorspace( $image->getColorspace() );
// remove existing color profiles from the watermark image
$watermark->stripImage();
// copy all color profiles from the original image to the watermark
$profiles = $image->getImageProfiles('*', false);
foreach ($profiles as $profile) {
$profileData = $image->getImageProfile($profile);
$watermark->profileImage($profile, $profileData);
}
I can do a pull request for all that if you are interested.
The text was updated successfully, but these errors were encountered: