I'm using the following to optimize some png images with pngcrush:
exec(
"pngcrush -q -blacken -brute -reduce -rem alla -rem text -rem time {$source} {$destination}",
$output,
$return_var
);
The optimization works really well, but for some images, the png is creating these black blocks where the transparency goes.
The problem goes away when I remove the -reduce option, but then the PNG optimization does very little, and it's no use at all running the optimization.
I'm assuming that the problem is to do with transparency, so is there a way to tell pngcrush, to skip the -reduce command, only for images that don't have transparency?
Don't use
-blacken
, as it is the immediate cause of your problem.From the changelog:
Possibly some of your transparent pixels are not as transparent as they seem.