【发布时间】:2013-08-03 08:28:54
【问题描述】:
我正在尝试使用libpng in C 从可以是灰度(8bits*1componant)或 rgb(8bits*3componant)的图像写入 PNG 文件。
我阅读了手册并编写了这段不起作用的代码:-/
/* writing the image */
png_byte *row_pointers[img->height];
int h;
for (h = 0 ; h < img->height ; h++)
{
row_pointers[h] = img->data+h*img->width*image_components;
}
png_write_image(png_ptr, row_pointers);
图像中没有写入任何内容,我不明白为什么。
img.data指向图像数据(RGB格式情况下交错)
【问题讨论】:
标签: c image-processing rgb grayscale libpng