imageconvolution leaves black dot in the upper left corner
- by Peter O.
I'm trying to sharp resized images using this code:
imageconvolution($imageResource, array(
array( -1, -1, -1 ),
array( -1, 16, -1 ),
array( -1, -1, -1 ),
), 8, 0);
When the transparent PNG image is sharpened, using code above, it appears with a black dot in the upper left corner (I have tried different convolution kernels, but the result is the same). After resizing the image looked OK.
1st image is the original one
2nd image is the sharpened one
EDIT: What am I going wrong? I'm using the color retrieved from pixel.
$color = imagecolorat($imageResource, 0, 0);
imageconvolution($imageResource, array(
array( -1, -1, -1 ),
array( -1, 16, -1 ),
array( -1, -1, -1 ),
), 8, 0);
imagesetpixel($imageResource, 0, 0, $color);
Is imagecolorat the right function? Or is the position correct?
EDIT2: I have changed coordinates, but still no luck. I've check the transparency given by imagecolorat (according to this post). This is the dump:
array(4) {
red => 0
green => 0
blue => 0
alpha => 127
}
Alpha 127 = 100% transparent. Those zeroes might cause the problem...