boost gil创建图像 [英] boost gil create image

查看:486
本文介绍了boost gil创建图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图阅读boost :: gil文档,但它是在缺少和复杂之间的某处。

I've been trying to read the boost::gil documentation, but it's somewhere between lacking, and convoluted.

不用说了,我需要一个例子执行以下操作:

Ranting aside, I need an example on how to do the following:

创建一张图片,比如512x512。用红色像素填充它。写入PNG。

Create an image of, say 512x512. Fill it with red pixels. Write to PNG.

在gil的文档中我找不到任何有关这方面的事情。

I can't find anything about doing any of that, at all, in the documentation for gil. Particularly the creating an image or filling it with pixels part.

推荐答案

如果有人可以帮助,解决方案

解决方案

我还没有使用GIL,但我想学习它。查看了设计指南并已上载与libpng 相关的错误,看起来最简单的例子是

I haven't used GIL yet, but I want to learn it as well. Having looked at the design guide and having googled up the error related to libpng, looks like the simplest example is

#define png_infopp_NULL (png_infopp)NULL
#define int_p_NULL (int*)NULL
#include <boost/gil/gil_all.hpp>
#include <boost/gil/extension/io/png_dynamic_io.hpp>
using namespace boost::gil;
int main()
{
    rgb8_image_t img(512, 512);
    rgb8_pixel_t red(255, 0, 0);
    fill_pixels(view(img), red);
    png_write_view("redsquare.png", const_view(img));
}

适用于我, -lpng ,产生此图片

这篇关于boost gil创建图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆