spatie / laravel-medialibrary

Associate files with Eloquent models
https://spatie.be/docs/laravel-medialibrary
MIT License
5.71k stars 1.07k forks source link

Larger that original #2582

Closed lloricode closed 2 years ago

lloricode commented 2 years ago

Hi I notice that the generated was larger than original upload

original original

generated generated

the result above is generated from desktop conversion

    public function registerMediaCollections(): void
    {
        $this->addMediaCollection('large-long')
            ->registerMediaConversions(
                function (Media $media) {
                    $this->addMediaConversion('desktop')
                        ->fit(Manipulations::FIT_CROP, 1920, 1080);

                    $this->addMediaConversion('tablet')
                        ->width(1200);

                    $this->addMediaConversion('mobile')
                        ->width(576);
                }
            );

environment: php: 7.4.23 media-library: 9.7.4

thank you

lloricode commented 2 years ago

I try run media-library:regenerate and check the optimiser

vagrant@homestead:~/code/laravel/project-cms-api$ jpegoptim --version
jpegoptim v1.4.6  x86_64-pc-linux-gnu
Copyright (C) 1996-2018, Timo Kokkonen

This program comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistirbute it under certain conditions.
See the GNU General Public License for more details.

libjpeg version: 8d  15-Jan-2012
Copyright (C) 1991-2019 The libjpeg-turbo Project and many others
vagrant@homestead:~/code/laravel/project-cms-api$ optipng --version
OptiPNG version 0.7.7
Copyright (C) 2001-2017 Cosmin Truta and the Contributing Authors.

This program is open-source software. See LICENSE for more details.

Portions of this software are based in part on the work of:
  Jean-loup Gailly and Mark Adler (zlib)
  Glenn Randers-Pehrson and the PNG Development Group (libpng)
  Miyasaka Masaru (BMP support)
  David Koblas (GIF support)

Using libpng version 1.6.37 and zlib version 1.2.11
vagrant@homestead:~/code/laravel/project-cms-api$ pngquant --version
2.12.0 (January 2018)
vagrant@homestead:~/code/laravel/project-cms-api$ svgo --version
1.3.2
vagrant@homestead:~/code/laravel/project-cms-api$ gifsicle --version
LCDF Gifsicle 1.92
Copyright (C) 1997-2019 Eddie Kohler
This is free software; see the source for copying conditions.
There is NO warranty, not even for merchantability or fitness for a
particular purpose.
freekmurze commented 2 years ago

I don't have the bandwidth to take a look at this now. My guess is that for most images it works ok, but for some particular ones it does not. Feel free to PR improvements.

lloricode commented 2 years ago

Thanks, will figure it out later

spatie-bot commented 2 years ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.