我有一个使用这个库的应用程序(实际上是一个直接端口到 D)进行一些图像处理。我正在寻找一些类似风格的其他库来用于加载其他文件类型。
我需要/想要的东西:
- 无损格式。
- 简单的 C API。
- 以原始像素格式将数据加载到缓冲区中。
- 开源(比如我可以获取源文件并编译它们供我自己使用,除此之外,许可并不重要)
有人知道类似的事情吗?
I have an app that uses this library (actually a direct port to D) for some image processing. I'm looking for some other libraries of a similar style to use to load other file types.
Things I need/want:
- Loss less format.
- Simple C API.
- Loads data into buffers in a raw pixel format.
- Open source (as in I can get source files and compile them for my own use, aside from that, licensing doesn't matter)
Anyone know of anything like that?
发布评论
评论(9)
PNG:要加载和保存,您可以尝试 LodePNG 库
C/C++: http://members.gamedev.net/lode/projects/LodePNG/
D 端口:www.dsource.org/projects/scrapple/wiki/LodePngLibrary
PNG: for loading and saving you can try LodePNG library
C/C++: http://members.gamedev.net/lode/projects/LodePNG/
D port: www.dsource.org/projects/scrapple/wiki/LodePngLibrary
devIL 和 SDL_Image 支持多种格式。
Derelict 提供了它们的绑定。
我自己的使用这些代码并具有原始缓冲区的代码:
devIL: http://codepad.org/tKonvsJ0
SDL_Image:http://codepad.org/jLJDNstw
devIL and SDL_Image supports a good deal of formats.
Derelict provides their bindings.
My own code for using these and have a raw buffer:
devIL: http://codepad.org/tKonvsJ0
SDL_Image: http://codepad.org/jLJDNstw
FreeImage 非常全面,而且非常干净且易于使用。
http://freeimage.sourceforge.net/
FreeImage is pretty comprehensive, and very clean and easy to use.
http://freeimage.sourceforge.net/
您可能想尝试 libpng,尽管我并不认为它易于使用。
除此之外,您可以尝试直接处理位图,根本不需要任何库。
You might want to try libpng, although I wouldn't exactly call it easy to use.
Other than that, you might try working directly on bitmaps, with no libraries at all.
我会考虑使用 imageMagick ( http://www.imagemagick.org/script/index.php )满足您所有的图像加载需求。
它支持多种不同位深度的多种格式,并且可以读取和写入其中的大多数格式。
它的功能可能比您需要的多得多,但它是一个设计精良的库,我已经在几个项目中使用过它。
它与 GPL 兼容。 (我认为商业许可证也是可用的)
I'd consider using imageMagick ( http://www.imagemagick.org/script/index.php ) for all your image loading needs.
It supports a lot of formats in a lot of different bit depths, reading and writing for most of them.
It may do a lot more than you need, but its a very well designed library and I've used it in several projects.
It is GPL compatible. (And I think commercial licenses are available too)
您始终可以尝试 gdimage 库。我从来没有遇到过任何问题,尽管我用它所做的大部分工作都是在 PHP 中进行的。
You could always try the gdimage library. I've never had any problems with it, though mist of the work I've done with it has been in PHP.
您可以使用 Netpbm 等软件与 PPM 格式,非常容易从任何程序读取/写入,无需外部库。
PPM 文件看起来像这样:
或像这样:
You can use software such as Netpbm to convert to/from PPM format, which is extremely easy to read/write from any program without needing external libraries.
A PPM file either looks like this:
or like this:
我认为 SOIL (简单的 OpenGL 图像库)非常适合您的描述。它有多种格式,iirc jpg 代码甚至是从与您的源相同的源移植的。
I think SOIL (Simple OpenGl Image Library) fits your description nicely. It has many formats, iirc the jpg code is even ported from the same source as yours.
CAPI 项目现已在 GitHub 上提供,用于图像处理。该库API简单,体积小,兼容性好。目前正在致力于提高速度。已在 Windows 和 Linux 上测试并运行。该库当前支持以下图像格式:
在下面的示例中,我将在 Windows 上的 Visual Studio 中使用 C++。
首先,我们需要一些简单的例程来加载和保存文件。为此,我创建了 LoadFile 和 SaveFile 函数。以下是一个示例控制台程序,用于将 .ico 格式的文件转换为 .png 格式的文件。
我们将使用的 CAPI 函数是:
在下一个示例中,我将创建一个具有双缓冲的简单窗口。
我们将在 Window_Paint_Handler 函数中将测试图像绘制到窗口。
我们将使用的 CAPI 函数是:
The CAPI project is now available on GitHub for image processing. This library has a simple API, is small in size, and has great compatibility. Speed improvements are currently being worked on. Tested and works on Windows and Linux. This library currently supports the following image formats:
In my following examples i will be using C++ in Visual Studio on Windows.
To get started first we need some simple routines for loading and saving files. I have created the functions LoadFile and SaveFile for this purpose. The following is an example console program to convert a .ico formatted file to a .png formatted file.
The CAPI functions we will be using are:
In this next example i will be creating a simple window that has double buffering.
We will draw our test image to the window in our Window_Paint_Handler function.
The CAPI functions we will be using are: