
Imagick::getImageAttribute 함수를 사용하여 이미지 속성을 가져올 때, 해상도 정보를 가져올 수 있는 속성은 'ResolutionX'와 'ResolutionY'입니다.
이 속성을 가져올 때 옵션을 지정할 수 있는 방법은 다음과 같습니다.
#hostingforum.kr
php
$imagick = new Imagick('image.jpg');
$resolutionX = $imagick->getImageAttribute('ResolutionX');
$resolutionY = $imagick->getImageAttribute('ResolutionY');
echo "해상도 X: $resolutionXn";
echo "해상도 Y: $resolutionYn";
이 코드는 'image.jpg' 이미지의 해상도 X와 Y를 가져와 출력합니다.
또한, 옵션을 지정할 때는 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$imagick = new Imagick('image.jpg');
$resolutionX = $imagick->getImageAttribute('ResolutionX', true); // true로 설정하면 float 값이 반환됩니다.
$resolutionY = $imagick->getImageAttribute('ResolutionY', true);
echo "해상도 X: $resolutionXn";
echo "해상도 Y: $resolutionYn";
이 코드는 'image.jpg' 이미지의 해상도 X와 Y를 가져와 float 값으로 출력합니다.
이러한 옵션을 사용하여 이미지 속성을 가져올 때 더 세부적인 정보를 얻을 수 있습니다.
2025-05-10 06:25