Imagick::textureImage

(PECL imagick 2, PECL imagick 3)

Imagick::textureImage β€” ΠœΠ½ΠΎΠ³ΠΎΠΊΡ€Π°Ρ‚Π½ΠΎ Ρ€Π°Π·ΠΌΠ΅Ρ‰Π°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ тСкстуры

ОписаниС

function Imagick::textureImage(Imagick $texture_wand): Imagick

ΠœΠ½ΠΎΠ³ΠΎΠΊΡ€Π°Ρ‚Π½ΠΎ Ρ€Π°Π·ΠΌΠ΅Ρ‰Π°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ тСкстуры ΠΏΠΎΠΏΠ΅Ρ€Ρ‘ΠΊ ΠΈ Π²Π½ΠΈΠ· ΠΏΠΎ холсту изобраТСния.

Бписок ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ²

texture_wand

ΠžΠ±ΡŠΠ΅ΠΊΡ‚ Imagick для использования Π² качСствС изобраТСния тСкстуры.

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅ΠΌΡ‹Π΅ значСния

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ Π½ΠΎΠ²Ρ‹ΠΉ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ Imagick, ΠΊ ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠΌΡƒ ΠΏΡ€ΠΈΠΌΠ΅Π½Π΅Π½Π° ΠΏΠΎΠ²Ρ‚ΠΎΡ€ΡΡŽΡ‰Π°ΡΡΡ тСкстура.

Ошибки

Ѐункция выбрасываСт ΠΈΡΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅ ImagickException, Ссли Π²ΠΎΠ·Π½ΠΈΠΊΠ»Π° ошибка.

ΠŸΡ€ΠΈΠΌΠ΅Ρ€Ρ‹

ΠŸΡ€ΠΈΠΌΠ΅Ρ€ #1 ΠŸΡ€ΠΈΠΌΠ΅Ρ€ использования Imagick::textureImage()

<?php
function textureImage($imagePath) {
$image = new \Imagick();
$image->newImage(640, 480, new \ImagickPixel('pink'));
$image->setImageFormat("jpg");
$texture = new \Imagick(realpath($imagePath));
$texture->scaleimage($image->getimagewidth() / 4, $image->getimageheight() / 4);
$image = $image->textureImage($texture);
header("Content-Type: image/jpg");
echo
$image;
}

?>
οΌ‹Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ

ΠŸΡ€ΠΈΠΌΠ΅Ρ‡Π°Π½ΠΈΡ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Π΅ΠΉ 2 notes

up
6
Dirk ΒΆ
12 years ago
This method doesn't actually return TRUE on success, it returns an Imagick with the texture applied, but the original Imagick object is not modified. As per the other examples on here, you need to use the result of textureImage call as your new tiled image.
up
2
truthseekercz at email dot cz ΒΆ
15 years ago
<?php

$image = new Imagick();
$image->newImage(500, 500, new ImagickPixel('red'));
$image->setImageFormat("png");
$type=$image->getFormat();
header("Content-type: $type");

$texture = new Imagick();
$texture->readImage('texture.png');
$image = $image->textureImage($texture);

echo $image;

?>

This works for me, however, I give no guarantees that the above example is the proper usage of this function.