Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在不使用imagemagick的情况下使用php将32位jpg图像转换为24位图像_Php_Image Processing_Gd_Imagemagick Convert - Fatal编程技术网

如何在不使用imagemagick的情况下使用php将32位jpg图像转换为24位图像

如何在不使用imagemagick的情况下使用php将32位jpg图像转换为24位图像,php,image-processing,gd,imagemagick-convert,Php,Image Processing,Gd,Imagemagick Convert,我有从十六进制字符串创建jpg图像的代码。生成的jpg图像具有32位深度,但我想将其设置为24位。是否可以在不使用imagemagick的情况下更改位深度 以下是生成JPG Img的代码: $hexstring = XXXXXXX; if(is_string($hexstring) && !empty($hexstring)) { $hex=''; for($a=0; $a<strlen($hexstring)

我有从十六进制字符串创建jpg图像的代码。生成的jpg图像具有32位深度,但我想将其设置为24位。是否可以在不使用imagemagick的情况下更改位深度

以下是生成JPG Img的代码:

$hexstring = XXXXXXX;
    if(is_string($hexstring) && !empty($hexstring))
    {
            $hex='';
            for($a=0; $a<strlen($hexstring); $a+=2)
            {
                    $hex.=chr(hexdec($hexstring{$a}.$hexstring{($a+1)}));
            }

            $fileHandle= fopen($imgFile, 'w+'); 
            fwrite($fileHandle,$hex); 
            fclose($fileHandle);
    }
$hexstring=XXXXXXX;
if(is_string($hextstring)&&!empty($hextstring))
{
$hex='';

对于($a=0;$a何谓32位jpeg文件?是否有共享文件?是否需要十六进制字符串??