Last active
February 4, 2021 15:45
-
-
Save Sebobo/94dd8ea909d2ed6ae813b7df70c20dc1 to your computer and use it in GitHub Desktop.
Test script for comparing imagine scaled file sizes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "imagine/test", | |
"require": { | |
"imagine/imagine": "^1.2", | |
"rokka/imagine-vips": "0.12.0" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
$vips = new Imagine\Vips\Imagine(); | |
$imagick = new Imagine\Imagick\Imagine(); | |
$gd = new Imagine\Gd\Imagine(); | |
$size = new Imagine\Image\Box(700, 439); | |
$mode = Imagine\Image\ImageInterface::THUMBNAIL_INSET; | |
$vips->open('original.png') | |
->thumbnail($size, $mode) | |
->save('thumbnail-vips-' . $size->getWidth() . 'x' . $size->getHeight() . '.png', array('png_compression_level' => 0, 'png_quality' => 90 )) | |
; | |
$imagick->open('original.png') | |
->thumbnail($size, $mode) | |
->save('thumbnail-im-' . $size->getWidth() . 'x' . $size->getHeight() . '.png', array('png_compression_level' => 0, 'quality' => 90)) | |
; | |
$gd->open('original.png') | |
->thumbnail($size, $mode) | |
->save('thumbnail-gd-' . $size->getWidth() . 'x' . $size->getHeight() . '.png', array('png_compression_level' => 0, 'quality' => 90)) | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment