2

有人可以指点我一个教程,其中解释了如何使用 libpng 和 png++ 在图像上应用双三次调整大小?我花了将近三个小时寻找一些东西,但找不到。也许是因为我不知道在哪里看。

图像(48 位图像)被读取,libpng然后读入QImage用于输出。如果我QImage::scaled在图像上使用,像素信息会丢失,图像对我需要的东西没有用处。

我使用 png::rgba_pixel_16 像素读取和操作图像 - 像这样读取它:

png::image< png::rgba_pixel_16 > myImage(myFile.toAscii());

引用另一个答案:

QImage 中每种组件格式没有 16 位。您可以获得的最多是 QImage::Format_ARGB32 每个组件 8 位。即使您使用 8 位索引模式,颜色表也不支持每个组件超过 8 位。此外,QImageIOHandler 类是根据 QImage 工作的,因此很遗憾,您无法创建自定义图像格式插件来处理每个颜色分量 16 位。

最后一句话解释了为什么我不能为此使用 QImage 。

4

3 回答 3

2

如果您只想以编程方式调整图像大小,请查看imagemagick

于 2012-03-07T08:43:55.117 回答
1

您不需要使用 Qt 的 libpng。

只需使用

QImage QImage::scaled ( const QSize & size, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode ) const

用于transformMode = Qt::SmoothTransformation双线性缩放。

于 2012-03-07T09:38:50.857 回答
0

Why do you need libpng? You could just read the image in a array and then perform resizing on that, you don't need libpng, after reading the image it becomes independent of the format...

于 2012-03-07T08:29:41.463 回答