I'm trying to figure out if it's possible to save a jpeg as an 8bit version instead of 16 bit or 24 bit.
I'm currently using imagecreate and then saving using imagejpeg but I can't see any parameters in the manual to allow for 8bit versions.
I've searched stackoverflow and php.net I find it hard to believe this isn't something easily achievable..
Thanks in advance
Have you tried imagemagic:
convert SRC.jpg -depth 8 -normalize DEST.jpg
and with PHP:
<?php
error_reporting(E_ALL);
$SRC = 'src.jpg';
$DEST = 'dest.jpg';
$handle = popen("convert $SRC -depth 8 -normalize $DEST 2>&1", 'r');
$read = fread($handle, 2096);
pclose($handle);
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.