PHP 8.4.6 Released!

Imagick::orderedPosterizeImage

(PECL imagick 2 >= 2.2.2, PECL imagick 3)

Imagick::orderedPosterizeImageExecuta um pontilhamento ordenado

Aviso

Esta função foi DESCONTINUADA a partir da Imagick 3.4.4. O uso desta função é fortemente desencorajado.

Descrição

public Imagick::orderedPosterizeImage(string $threshold_map, int $channel = Imagick::CHANNEL_DEFAULT): bool

Executa um pontilhamento ordenado com base em vários mapas de limite de pontilhamento predefinidos, mas em vários níveis de intensidade, que podem ser diferentes para canais diferentes, de acordo com os argumentos de entrada. Este método estará disponível se a extensão Imagick tiver sido compilada com a ImageMagick versão 6.3.1 ou superior.

Parâmetros

threshold_map

Uma string contendo o nome do mapa de limite de pontilhamento a ser usado.

channel

Forneça qualquer constante de canal válida para o modo de canal. Para aplicar a mais de um canal, combine constantes de tipo de canal usando operadores bit a bit. Consulte esta lista de constantes de canal.

Valor Retornado

Retorna true em caso de sucesso.

Erros/Exceções

Lança uma exceção ImagickException em caso de erro.

Exemplos

Exemplo #1 Exemplo de Imagick::orderedPosterizeImage()

<?php
function orderedPosterizeImage($imagePath, $orderedPosterizeType) {
$imagick = new \Imagick(realpath($imagePath));

$imagick->orderedPosterizeImage($orderedPosterizeType);
$imagick->setImageFormat('png');

header("Content-Type: image/png");
echo
$imagick->getImageBlob();
}

/ orderedPosterizeImage($imagePath, 'o4x4,3,3');
/ orderedPosterizeImage($imagePath, 'o8x8,6,6');
orderedPosterizeImage($imagePath, 'h8x8a');

?>

adicione uma nota

Notas Enviadas por Usuários (em inglês) 1 note

up
0
holdoffhunger at gmail dot com
12 years ago
Originally, I thought this function would be similar to the Posterize function, or at least, any one of the Imagick class functions that produces an artistic effect (like the oilPaintImage function). This function can be used for those purposes, but it is mostly geared toward print production. The OrderedPosterize is simply a highly flexible dithering tool. The intention essentially is to produce high-resolution imagery by means of using constant dots across a medium that vary in size according to the detail of the imagery. Everyone has seen a dithered photograph inside of a newspaper, but the wiki page provides better examples: http://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel .

Finally, don't forget you can use bitwise operators on the second parameter. That means you can use & to AND them, | to OR them, & to XOR them, and ~ to NEGATE them. A valid parameter for the second parameter would be: "((~imagick::CHANNEL_GREEN) ^ imagick::CHANNEL_YELLOW) | imagick::CHANNEL_MAGENTA)". You can get extremely creative in this particular parameter. And if you want to define your own brushes using simple XML, then that's also true of the first parameter, too.

Note: You can use this function artistically. How? Use the orderedPosterizeImage to give the image some texture (a photo of a vase, for instance), and then use your OilPoint, Sketch, or Standard Posterize to give the image a cool effect. Alone, though, seems pretty boring.

And now, a very simple demonstration :

<?php

/ Author: [email protected]

/ Filename
/ ---------------------------------------------

$file_to_grab_with_location = "graphics_engine/image_workshop_directory/ordered_posterize_source.bmp"

$imagick_type = new Imagick();

/ Open File
/ ---------------------------------------------

$file_handle_for_viewing_image_file = fopen($file_to_grab_with_location, 'a+');

$imagick_type->readImageFile($file_handle_for_viewing_image_file);

/ Perform Function
/ ---------------------------------------------

$imagick_type->orderedPosterizeImage("o2x2", imagick::CHANNEL_GREEN);

/ Save File
/ ---------------------------------------------

$file_to_save_with_location = "graphics_engine/image_workshop_directory/ordered_posterize_result.bmp"

$file_handle_for_saving_image_file = fopen($file_to_save_with_location, 'a+');

$imagick_type->writeImageFile($file_handle_for_saving_image_file);

?>
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant