PHP 8.3.4 Released!

Imagick::stripImage

(PECL imagick 2, PECL imagick 3)

Imagick::stripImage画像からすべてのプロパティやコメントを除去する

説明

public Imagick::stripImage(): bool

画像からすべてのプロパティやコメントを除去します。

パラメータ

この関数にはパラメータはありません。

戻り値

成功した場合に true を返します。

エラー / 例外

エラー時に ImagickException をスローします。

add a note

User Contributed Notes 3 notes

up
25
Max Eremin
7 years ago
StripImage also delete ICC image profile by default.
The resulting images seem to lose a lot of color information and look "flat" compared to their non-stripped versions.

Consider keeping the ICC profile (which causes richer colors) while removing all other EXIF data:

1. Extract the ICC profile
2. Strip EXIF data and image profile
3. Add the ICC profile back

The code is:
<?php
$profiles
= $img->getImageProfiles("icc", true);

$img->stripImage();

if(!empty(
$profiles))
$img->profileImage("icc", $profiles['icc']);
?>
up
16
g dot a dot karthikeyan at gmail dot com
10 years ago
Please note that striping off the exif information without handling the orientation information available in the exif will lead to wrong orientation of the image
up
5
pengc99
12 years ago
this will actually clear exif data so if you run an image uploading script with privacy concerns, this will effectively clear all GPS / metadata from the image.
To Top