Imagick::getQuantumRange

(PECL imagick 2, PECL imagick 3)

Imagick::getQuantumRange β€” Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ Π²Π΅Π»ΠΈΡ‡ΠΈΠ½Ρƒ Ρ€Π°Π·ΠΌΠ΅Ρ€Π° спСктра Imagick

ОписаниС

public static function Imagick::getQuantumRange(): array

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ Π²Π΅Π»ΠΈΡ‡ΠΈΠ½Ρƒ Ρ€Π°Π·ΠΌΠ΅Ρ€Π° спСктра для ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π° Imagick.

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

Π‘ΠΈΠ³Π½Π°Ρ‚ΡƒΡ€Π° Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ Π½Π΅ содСрТит ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ².

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

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ ассоциативный массив, содСрТащий Ρ€Π°Π·ΠΌΠ΅Ρ€ спСктра ΠΊΠ°ΠΊ Ρ†Π΅Π»ΠΎΠ΅ число int ("quantumRangeLong") ΠΈ ΠΊΠ°ΠΊ строку string ("quantumRangeString").

Ошибки

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

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

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

up
0
holdoffhunger at gmail dot com ΒΆ
14 years ago
The getQuantumRange is a useful function, since many of the ImageMagick functions accept parameters from 0 to a maximum of the Quantum Range.  When getting a return value for this, it doesn't return a string.  It actually returns an array, with one type being a String ('quantumRangeLong') and the other type being a Long Int ('quantumRangeString').  Here's some sample code and the results, given a color, BMP file photograph that is 600x450 pixels...

<?php

            // Author: holdoffhunger@gmail.com
    
        // Imagick Type
        // ---------------------------------------------

    $imagick_type = new Imagick();
    
        // Open File
        // ---------------------------------------------
        
    $file_to_grab = "image_workshop_directory/test.bmp";
    
    $file_handle_for_viewing_image_file = fopen($file_to_grab, 'a+');
    
        // Grab File
        // ---------------------------------------------

    $imagick_type->readImageFile($file_handle_for_viewing_image_file);
    
        // Get Quantum Range
        // ---------------------------------------------
        
    $imagick_type_quantum_range = $imagick_type->getQuantumRange();
    
        // Print Results
        // ---------------------------------------------

    print("<pre>");
    print_r($imagick_type_quantum_range);
    print("</pre>");

?>

Output:

Array
(
    [quantumRangeLong] => 65535
    [quantumRangeString] => 65535
)