裁剪小文件填充干预图像

Crop small file fill with intervention image

有办法使用干预图像用透明度填充我裁剪后的 png 的黑色区域吗?

 $data = file_get_contents("php://input"); 

    $img = Image::make($data);

    $path = sprintf("%/data/%s/img",public_path(),Auth::user()->account_id);

    @mkdir($path,0775,true);

    $img->crop(350, 150)->encode('png', 90)->save(sprintf("%s/logo.png",$path));

trim方法解决了!

解决方案:

$img->crop(350, 150)->encode('png', 90)->trim()->save(sprintf("%s/logo.png",$path));