Imagemagic resize9/20/2023 ![]() with substituted by some valid version):ĬOPY -from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/įinally, I ran the test script from above using docker run -it imgbench php imgbench.php.Īll the files used for this test, can be found here: imgbench.zip. Then, I built the following Dockerfile (using docker build -t imgbench. I created a new AWS EC2 t3.medium instance with the Amazon Linux AMI and installed Docker using sudo yum install docker. $image_blob = $image-> getImageBlob() bench(" blob") $image-> setInterlaceScheme( Imagick:: INTERLACE_JPEG) bench(" interlace") $image-> setImageCompressionQuality( $image_quality) bench(" compress") $image-> resizeImage( $image_size, $image_size, Imagick:: FILTER_LANCZOS, 1, true) bench(" resize") Tested in Ubuntu 18.10, ffpmeg 4.0.2-2, ImageMagick 6.9.10-8.ReadImage( $image_name) bench(" read") TODO: why can they make it smaller than convert? Are they just selecting better more minimal diff rectangles, or something else? See also: How do I create an animated gif from still images (preferably with the command line)? Gifsicle -resize 256x256 out-convert.gif > out-gifsicle.gifĪnd both produced an even smaller correctly looking 1.5 MiB output. ![]() I also tried out the following commands: ffmpeg -i out-convert.gif -vf scale=256:-1 out-ffmpeg-small.gif Not considerably smaller than out-coalesce.gif, but I think this is just because the black ground compresses really well, and it could be very significant in general. Out-deconstruct.gif: compressed frames, final output size 1.9 MiB. Output looks visually correct, but the output file size is 2.0 MiB, which is larger than out-deconstruct.gif ![]() Out-coalesce.gif: all frames are 256x256 and have the correct offset 0+0. Visually incorrect, since those approximately 256x256 frames have a non-zero offset, e.g. Out.gif: All frames are 256x256 or larger, and huge at about 5MiB, TODO why? Then, if we compare the three conversions: $ identify out-deconstruct.gif | head -n 3 $ convert out-convert.gif -coalesce -resize 256x -deconstruct out-deconstruct.gif $ convert out-convert.gif -coalesce -resize 256x out-coalesce.gif $ convert out-convert.gif -resize 256x out.gif ![]() Using the test data from this answer: How do I create an animated gif from still images (preferably with the command line)? we can see this clearly with identify: $ identify out-convert.gif | head -n 3 coalesce then expands all the frames to the original size, which makes the resize work, but it does not re-compress the frames again as your input image: -deconstruct is needed for that! The root cause of the problem is that your input GIF was properly minimized: GIF allows the next frame to be just the modified rectangle from the previous one at an offset. After -coalesce, you likely want to add a -deconstruct: convert in.gif -coalesce -resize 256x -deconstruct out-deconstruct.gif
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |