mardi 26 juin 2018

Laravel image intervention image resize looses quality

I'm trying to write a text on a loaded image. And after that, i'm resizing it to a lower size (324x204)

Here's the code:

    $img = \Image::make('draft_clientid2.jpg');

    $img->text('NAME', 650,270, function($font) {
        $font->file('Raleway/Raleway-Bold.ttf');
        $font->size(40);
        $font->color('#000000');
        $font->align('center');
        $font->valign('top');
        $font->angle(0);

    }); 
    $img->text('OOOMOF-PC00001', 650, 420, function($font) {
        $font->file('Raleway/Raleway-Bold.ttf');
        $font->size(40);
        $font->color('#000000');
        $font->align('center');
        $font->valign('top');
        $font->angle(0);

    });
    $img->resize(324,204);
    $img->save('resized-image.jpg');
    return $img->response('jpg');

The problem is, the resized image has a big loss in quality. How can i resize the image without loosing its quality?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire