|
411 | 411 | * If you want to avoid the copies, you'll need to call drawing operations
|
412 | 412 | * yourself.
|
413 | 413 | *
|
| 414 | + * # Thumbnailing |
| 415 | + * |
| 416 | + * The thumbnailing functionality is implemented by `Vips\Image::thumbnail` and |
| 417 | + * `Vips\Image::thumbnail_buffer` (which thumbnails an image held as a string). |
| 418 | + * |
| 419 | + * You could write: |
| 420 | + * |
| 421 | + * ```php |
| 422 | + * $filename = 'image.jpg'; |
| 423 | + * $image = Vips\Image::thumbnail($filename, 200, ['height' => 200]); |
| 424 | + * $image->writeToFile('my-thumbnail.jpg'); |
| 425 | + * ``` |
| 426 | + * |
| 427 | + * # Resample |
| 428 | + * |
| 429 | + * There are three types of operation in this section. |
| 430 | + * |
| 431 | + * First, `->affine()` applies an affine transform to an image. |
| 432 | + * This is any sort of 2D transform which preserves straight lines; |
| 433 | + * so any combination of stretch, sheer, rotate and translate. |
| 434 | + * You supply an interpolator for it to use to generate pixels |
| 435 | + * (@see Image::newInterpolator()). It will not produce good results for |
| 436 | + * very large shrinks: you'll see aliasing. |
| 437 | + * |
| 438 | + * `->reduce()` is like `->affine()`, but it can only shrink images, |
| 439 | + * it can't enlarge, rotate, or skew. |
| 440 | + * It's very fast and uses an adaptive kernel (@see Kernel for possible values) |
| 441 | + * for interpolation. It will be slow for very large shrink factors. |
| 442 | + * |
| 443 | + * `->shrink()` is a fast block shrinker. It can quickly reduce images by large |
| 444 | + * integer factors. It will give poor results for small size reductions: |
| 445 | + * again, you'll see aliasing. |
| 446 | + * |
| 447 | + * Next, `->resize()` specialises in the common task of image reduce and enlarge. |
| 448 | + * It strings together combinations of `->shrink()`, `->reduce()`, `->affine()` |
| 449 | + * and others to implement a general, high-quality image resizer. |
| 450 | + * |
| 451 | + * Finally, `->mapim()` can apply arbitrary 2D image transforms to an image. |
| 452 | + * |
414 | 453 | * # Expansions
|
415 | 454 | *
|
416 | 455 | * Some vips operators take an enum to select an action, for example
|
@@ -742,7 +781,7 @@ public static function newFromFile(
|
742 | 781 | }
|
743 | 782 |
|
744 | 783 | /**
|
745 |
| - * Find the name of the load oepration vips will use to load a file, for |
| 784 | + * Find the name of the load operation vips will use to load a file, for
10000
td> |
746 | 785 | * example "VipsForeignLoadJpegFile". You can use this to work out what
|
747 | 786 | * options to pass to newFromFile().
|
748 | 787 | *
|
@@ -794,7 +833,7 @@ public static function newFromBuffer(
|
794 | 833 | }
|
795 | 834 |
|
796 | 835 | /**
|
797 |
| - * Find the name of the load oepration vips will use to load a buffer, for |
| 836 | + * Find the name of the load operation vips will use to load a buffer, for |
798 | 837 | * example 'VipsForeignLoadJpegBuffer'. You can use this to work out what
|
799 | 838 | * options to pass to newFromBuffer().
|
800 | 839 | *
|
@@ -850,6 +889,26 @@ public static function newFromArray(
|
850 | 889 | return self::wrapResult($result);
|
851 | 890 | }
|
852 | 891 |
|
| 892 | + /** |
| 893 | + * Make an interpolator from a name. |
| 894 | + * |
| 895 | + * @param string $name Name of the interpolator. |
| 896 | + * Possible interpolators are: |
| 897 | + * - `'nearest'`: Use nearest neighbour interpolation. |
| 898 | + * - `'bicubic'`: Use bicubic interpolation. |
| 899 | + * - `'bilinear'`: Use bilinear interpolation (the default). |
| 900 | + * - `'nohalo'`: Use Nohalo interpolation. |
| 901 | + * - `'lbb'`: Use LBB interpolation. |
| 902 | + * - `'vsqbs'`: Use the VSQBS interpolation. |
| 903 | + * |
| 904 | + * @return resource|null The interpolator, or null on error. |
| 905 | + */ |
| 906 | + public static function newInterpolator(string $name) |
| 907 | + { |
| 908 | + // added in 1.0.7 of the binary module |
| 909 | + return vips_interpolate_new($name); |
| 910 | + } |
| 911 | + |
853 | 912 | /**
|
854 | 913 | * Create a new image from a constant.
|
855 | 914 | *
|
|
0 commit comments