ImagickPixel::setHSL

(PECL imagick 2, PECL imagick 3)

ImagickPixel::setHSLSets the normalized HSL color

Beschreibung

public ImagickPixel::setHSL(float $hue, float $saturation, float $luminosity): bool

Sets the color described by the ImagickPixel object using normalized values for hue, saturation and luminosity.

Parameter-Liste

hue

The normalized value for hue, described as a fractional arc (between 0 and 1) of the hue circle, where the zero value is red.

saturation

The normalized value for saturation, with 1 as full saturation.

luminosity

The normalized value for luminosity, on a scale from black at 0 to white at 1, with the full HS value at 0.5 luminosity.

Rückgabewerte

Liefert true bei Erfolg.

Beispiele

Beispiel #1 Use ImagickPixel::setHSL() to modify a color

<?php

//Create an almost pure red color
$color = new ImagickPixel('rgb(90%, 10%, 10%)');

//Get it's HSL values
$colorInfo $color->getHSL();

//Rotate the hue by 180 degrees
$newHue $colorInfo['hue'] + 0.5;
if (
$newHue 1) {
    
$newHue $newHue 1;
}

//Set the ImagickPixel to the new color
$colorInfo $color->setHSL($newHue$colorInfo['saturation'], $colorInfo['luminosity']);

//Check that the new color is blue/green
$colorInfo $color->getcolor();
print_r($colorInfo);

?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

Array
(
    [r] => 26
    [g] => 230
    [b] => 230
    [a] => 255
)

Anmerkungen

Hinweis:

Available with ImageMagick library version 6.2.9 and higher.

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Grundlagen von Views in MySQL

Views in einer MySQL-Datenbank bieten die Möglichkeit, eine virtuelle Tabelle basierend auf dem Ergebnis einer SQL-Abfrage zu erstellen. ...

admin

Autor : admin
Kategorie: mySQL-Tutorials

Definition von Stored Procedures - eine Einführung

Stored Procedures sind vordefinierte SQL-Codeblöcke, die in einer Datenbank gespeichert sind und bei Bedarf aufgerufen werden können. ...

Bernie

Autor : ebiz-consult GmbH & Co. KG
Kategorie: mySQL-Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Spielplan für 4 Gruppen zu je 6 Teams auf 2 Feldern

Hey, hallöchen! Du musst die Spiele so durchgehen, dass die Platzierung kontrolliert wechseln, dass jedes Team auf den Plätzen spielt. Hier ist ...

Geschrieben von Nico_Schubert am 14.05.2024 07:17:28
Forum: PHP Developer Forum
Bild drehen

Hallo, Du hast den Drehwinkel und den Pfad zum Bild bereits richtig im Post-Array. Hier ist ein vollständiges Beispiel, wie du das Bild drehst u ...

Geschrieben von Nico_Schubert am 14.05.2024 06:55:15
Forum: PHP Developer Forum
Berechnungen durchführen

Hallo Matze, gerne helfe ich dir bei deinem Projekt. Lass uns deine Fragen Schritt für Schritt angehen: Erste Frage: Ist das Konstrukt so richt ...

Geschrieben von Nico_Schubert am 14.05.2024 06:43:13
Forum: PHP Developer Forum
Bild drehen

Ich denke, dass die Aussage von scatello richtig ist und stimme ihm zu.

Geschrieben von LucyCoffee am 10.05.2024 12:04:18
Forum: PHP Developer Forum