PHP 8.4.0 RC4 available for testing

Imagick::profileImage

(PECL imagick 2, PECL imagick 3)

Imagick::profileImageAdiciona ou remove um perfil de uma imagem

Descrição

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

Adiciona ou remove um perfil ICC, IPTC ou genérico de uma imagem. Se o perfil for NULL, ele será removido da imagem adicionada. Use um nome '*' e um perfil NULL para remover todos os perfis da imagem.

Parâmetros

name

profile

Valor Retornado

Retorna true em caso de sucesso.

Erros/Exceções

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

adicione uma nota

Notas Enviadas por Usuários (em inglês) 3 notes

up
7
dadima, gmail
10 years ago
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.
up
8
Eero Niemi (eero at eero dot info)
16 years ago
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.
up
-1
gavin at softyolk dot com
15 years ago
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.
To Top