I'm currently using intervention/image to resize images and save them as JPG.
I have the same code running locally in Windows and remotely in Ubuntu 20.20.
In Windows it does the conversion PNG to JPG converting the transparent background into white. However, in Ubuntu, is adding black noise on top of the white background.
The code I run is:
$resize = Image::make($img)->encode('jpg');
$resize->height() > $resize->width() ? $width = null : $height = null;
$resize->resize($width, $height, function ($constraint) {
$constraint->aspectRatio();
});
Should I add something else before the encode
in order to ensure that the transparency makes white?
sudo apt install jpegoptim optipng pngquant gifsicle -y && npm install -g svgo
– Cannelloni