PHP.mk документација

Imagick::profileImage

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

imagick.profileimage.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека imagick.profileimage.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
Imagick::profileImage

Референца за `imagick.profileimage.php` со подобрена типографија и навигација.

imagick.profileimage.php

Imagick::profileImage

(PECL imagick 2, PECL imagick 3)

Imagick::profileImageДодава или отстранува профил од слика

= NULL

public Imagick::profileImage(string $name, string $profile = ?): bool

Adds or removes a ICC, IPTC, or generic profile from an image. If the profile is null, it is removed from the image rather than added.

To remove every single profile from the image use '*' како name and null » PEAR profile.

Параметри

name
The profile name.
profile
The profile data. If null, the specified profile will be deleted.

Вратени вредности

Патеката до PHP скриптата што треба да се провери. true на успешен исход.

Errors/Exceptions

Фрла ImagickException при грешка.

Белешки од корисници 4 белешки

dadima, gmail
пред 11 години
If profileImage() seems to be doing nothing — and "inverted colors" during a CMYK > RGB conversion is a sign of this — check that ImageMagick has the lcms delegate available.
From a command prompt:
convert -list configure | grep DELEGATES

If you don't see lcms in the list then Imagick won't do any color profile conversions, and won't give any warnings about this.  In that case, install the Little CMS library ( http://www.littlecms.com/ ) and recompile ImageMagick.
Eero Niemi (eero на eero точка info)
пред 17 години
If you need to convert images that are on CMYK format into RGB and want to preserve colour information, this may be helpful:

<?php
$image = new Imagick("CMYK_image.jpg"); // load image
$profiles = $image->getImageProfiles('*', false); // get profiles
$has_icc_profile = (array_search('icc', $profiles) !== false); // we're interested if ICC profile(s) exist

if ($has_icc_profile === false)
{
  // image does not have CMYK ICC profile, we add one
  $icc_cmyk = file_get_contents('/path/to/icc/SomeCMYKProfile.icc');
  $image->profileImage('icc', $icc_cmyk);
}

// Then we need to add RGB profile
$icc_rgb = file_get_contents('/path/to/icc/SomeRGBProfile.icc');
$image->profileImage('icc', $icc_rgb);

$image->setImageColorSpace(Imagick::COLORSPACE_RGB);

$image->writeImage("RGB_image.jpg");

?>

There may be better and more elegant ways to do this, but hope this helped.
aschmidt на anamera точка net
пред 5 месеци
Instantiating an image files, and attempting to save them in PNG format using setImageFormat('PNG'), I occasionally encountered
"gd-png: libpng warning: iCCP: profile 'icc': 'CMYK': invalid ICC profile color space".

However, transformimagecolorspace( \Imagick::COLORSPACE_SRGB ) had not effect, because getImageColorspace() did not indicate COLORSPACE_CMYK.

Instead, one has to check for the presence of any ICC profile,  inspect the ICC profile header (offset 16) for the "CMYK" color space tag, and then remove the ICC profile:

$ICC_count = remove_ICC( $image, 'CMYK');

function remove_ICC( \Imagick $image, ?string $colorspace ): int
{
    $icc_count = 0;
    
    foreach ( $image->getImageProfiles( 'icc' ) as $name => $profile ) {
        if ( empty( $colorspace ) or 0 === strcasecmp( $colorspace, substr( $profile, 16, 4 ) ) )
            // Either consider all ICC profiles, or just those matching the color space.
            $icc_count++;
    }
    
    if ( $icc_count > 0 )
        $image->profileImage( 'icc', null );        // Delete any ICC profiles.
        
        return $icc_count;
}
gavin at softyolk dot com
пред 16 години
Thanks for this very valuable information. 
For a further push in the correct direction please 
consider that you have to download the profiles, 

and your most likely sources are:

http://www.color.org/srgbprofiles.xalter

and

http://www.adobe.com/support/downloads/product.jsp?product=62&platform=Windows

Note that the profiles are free, but you must install them 
to make them available on you host system.
Навигација

Прелистувај сродни теми и функции.

На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.