我有一个PHP应用程序.
所以,我不知道这是否可能,但是我能把PNG-8转换成PNG-24 (或者其他类型的PNG)吗?
我对PNG类型不太了解,但是根据http://www.fileformat.info,工作图像的元数据看起来如下…
<javax_imageio_png_1.0>
<IHDR width="600" height="764" bitDepth="8" colorType="RGB" compressionMethod="deflate" filterMethod="adaptive" interlaceMethod="none"/>
<pHYs pixelsPerUnitXAxis="7874" pixelsPerUnitYAxis="7874" unitSpecifier="meter"/>
<tIME year="2013" month="4" day="25" hour="14" minute="9" second="17"/>
</javax_imageio_png_1.0>来自失败图像的元数据看起来是这样的..。
<javax_imageio_png_1.0>
<IHDR width="600" height="755" bitDepth="8" colorType="Grayscale" compressionMethod="deflate" filterMethod="adaptive" interlaceMethod="none"/>
<pHYs pixelsPerUnitXAxis="7874" pixelsPerUnitYAxis="7874" unitSpecifier="meter"/>
<tIME year="2013" month="4" day="23" hour="21" minute="10" second="33"/>
</javax_imageio_png_1.0>发布于 2013-04-26 03:00:30
PNG-8是指带有索引调色板的PNG图像.它几乎总是一个较小的文件大小,但限于256种颜色。PNG-24是全彩色的.
在PHP中将调色板图像转换为全色图像的最简单方法如下所示:
$src = imagecreatefrompng("my-indexed-image.png");
$dst = imagecreatetruecolor($w=imagesx($src),$h=imagesy($src));
imagecopy($dst,$src,0,0,0,0,$w,$h);
imagedestroy($src);
// now do stuff with $dsthttps://stackoverflow.com/questions/16228019
复制相似问题