Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress the JPEG comment created by imagejpeg?

In a php application, I took over JPG files are created using the "imagejpeg" function. In each of these files, there is a comment like "CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), quality = 90". Now our company security guidelines demand blocking for images containing comments. So I am trying to generate JPGs without a comment.

I searched the web, but I couldn't find a way to stop gd from adding this comment. Is it possible at all or do I to have to use another library or the like?

like image 425
d-fens Avatar asked Jan 08 '13 13:01

d-fens


1 Answers

IMO it is impossible to block it, only remove using Imagick:

$img = new Imagick('input.jpg');
$img->stripImage();
$img->writeImage('output-imagick.jpg');
$img->destroy();
like image 88
long Avatar answered Nov 15 '22 01:11

long