略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Imagick::getImageCompression

2024-12-22

Imagick::getImageCompression

(PECL imagick 3 >= 3.3.0)

Imagick::getImageCompressionGets the current image's compression type

说明

public Imagick::getImageCompression(): int

Gets the current image's compression type.

参数

此函数没有参数。

返回值

Returns the compression constant

add a noteadd a note

User Contributed Notes 3 notes

up
0
Mondragon
1 year ago
Example use:

$im = new Imagick("mypicture.jpg");
$ctype = $im->getImageCompression();
if($ctype == Imagick::COMPRESSION_ZIP) echo "PNG file!";
if($ctype == Imagick::COMPRESSION_JPEG) echo "JPG file!";
if($ctype == Imagick::COMPRESSION_LZW) echo "GIF file!";

All options:
COMPRESSION_UNDEFINED
COMPRESSION_NO
COMPRESSION_BZIP
COMPRESSION_FAX
COMPRESSION_GROUP4
COMPRESSION_JPEG
COMPRESSION_JPEG2000
COMPRESSION_LOSSLESSJPEG
COMPRESSION_LZW
COMPRESSION_RLE
COMPRESSION_ZIP
COMPRESSION_DXT1
COMPRESSION_DXT3
COMPRESSION_DXT5
COMPRESSION_ZIPS
COMPRESSION_PIZ
COMPRESSION_PXR24
COMPRESSION_B44
COMPRESSION_B44A
COMPRESSION_LZMA
COMPRESSION_JBIG1
COMPRESSION_JBIG2

The numbers for which those constants stand differ by version. So always use the constants.
up
-1
undoable at gmail dot com
8 years ago
This function is undefined. You must use getImageCompressionQuality() instead.
up
-1
alitrix at gmail dot com
4 years ago
This function is added in version 3.3.0 and above

官方地址:https://www.php.net/manual/en/imagick.getimagecompression.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3