解码JPEG以获得未压缩的数据

时间:2022-10-09 21:20:36

I want to decode JPEG files and obtain uncompressed decoded output in BMP/RGB format.I am using GNU/Linux, and C/C++.

我想解码JPEG文件,获得BMP/RGB格式的未压缩解码输出。我正在使用GNU/Linux和C/ c++。

I had a look at libjpeg, but there seemed not to be any good documentation available. So my questions are:

我查看了libjpeg,但似乎没有任何好的文档可用。所以我的问题是:

  1. Where is documentation on libjpeg?
  2. 关于libjpeg的文档在哪里?
  3. Can you suggest other C-based jpeg-decompression libraries?
  4. 您能建议其他基于c的jpeg-解压缩库吗?

5 个解决方案

#1


6  

The documentation for libjpeg comes with the source-code. Since you haven't found it yet:

libjpeg的文档附带源代码。既然你还没找到它:

Download the source-code archive and open the file libjpeg.doc. It's a plain ASCII file, not a word document, so better open it in notepad or another ASCII editor.

下载源代码压缩文件并打开libjpeg.doc文件。它是一个普通的ASCII文件,而不是word文档,所以最好用记事本或其他ASCII编辑器打开它。

There are some other .doc files as well. Most of them aren't that interesting though.

还有一些其他的。doc文件。但大多数都不是那么有趣。

Unfortunately I cannot recommend any other library besides libjpeg. I tried a couple of alternatives, but Libjpeg always won. Is pretty easy to work with once you have the basics done. Also it's the most complete and most stable jpeg library out there.

不幸的是,除了libjpeg,我不能推荐任何其他库。我尝试了几个替代方案,但Libjpeg总是胜出。一旦您完成了基本的工作,就很容易进行工作。它也是最完整、最稳定的jpeg库。

#2


2  

MagickWand is the C API for ImageMagick:

MagickWand是ImageMagick的C API:

http://imagemagick.org/script/magick-wand.php

http://imagemagick.org/script/magick-wand.php

I have not used it, but the documentation looks quite extensive.

我还没有使用它,但是文档看起来相当广泛。

#3


2  

You should check out Qt's QImage. It has a pretty easy interface that makes this task really easy. Setup is pretty simple for every platform.

您应该检查Qt的QImage。它有一个非常简单的界面,使得这个任务非常简单。对于每个平台,设置都非常简单。

If Qt is overkill, you can try Magick++ http://www.imagemagick.org/Magick++/. It supports similar operations and is also well suited for that sort of task. The last time I used it, I struggled a bit with dependencies for it on Windows, but don't recall much trouble on Linux.

如果Qt过高,您可以尝试Magick+ http://www.imagemagick.org/Magick+ /。它支持类似的操作,也非常适合这种任务。上次使用它时,我在Windows上与它的依赖关系上遇到了一些困难,但在Linux上不记得有什么麻烦。

For Magick++'s Image class, the function you probably want is getConstPixels.

对于Magick+ 's的图像类,您可能需要的函数是getConstPixels。

#4


1  

I have code that you can copy ( or just use as a reference ) for loading a jpeg image using the libjpeg library.

You can browse the code here: http://code.google.com/p/kgui/source/browse/trunk/kguiimage.cpp

Just look for the function LoadJPGImage.

The code is setup to handle c++ binding of my DataHandle class to it for loading the image, that way the image can be a file or data already in memory or whatever.

我有一些代码,您可以通过libjpeg库复制(或仅作为参考)来加载jpeg图像。您可以在这里浏览代码:http://code.google.com/p/kgui/source/browse/trunk/kguiimage.cpp,只需查找函数LoadJPGImage。这段代码是用来处理我的DataHandle类的c++绑定,以便加载映像,这样映像就可以是内存中已经存在的文件或数据。

#5


1  

A slightly out of the box solution is to acquire a copy of the netpbm tools, which transform images from pretty much any format to any other format via one of several very simple intermediate formats. They work well from the shell, and are most often used in pipes to read some arbitrary image, perform an operation on it, and write it out to some other format.

一种稍微与众不同的解决方案是获得netpbm工具的副本,该工具通过几种非常简单的中间格式之一将图像从几乎任何格式转换为任何其他格式。它们在shell中工作得很好,通常用于管道中读取任意图像,对其执行操作,并将其写入其他格式。

The pbm formats can be as simple as a plain ASCII header followed by the RGB data in ASCII or binary. They are intended to be simple enough to use without required a library to implement.

pbm格式可以像普通的ASCII头一样简单,后面跟着ASCII或二进制的RGB数据。它们的目的是要足够简单,以便在不需要实现库的情况下使用。

JPEG is supported in netpbm by read and write filters that are implemented on top of libjpeg.

在netpbm中,JPEG通过在libjpeg上实现的读写过滤器来支持。

#1


6  

The documentation for libjpeg comes with the source-code. Since you haven't found it yet:

libjpeg的文档附带源代码。既然你还没找到它:

Download the source-code archive and open the file libjpeg.doc. It's a plain ASCII file, not a word document, so better open it in notepad or another ASCII editor.

下载源代码压缩文件并打开libjpeg.doc文件。它是一个普通的ASCII文件,而不是word文档,所以最好用记事本或其他ASCII编辑器打开它。

There are some other .doc files as well. Most of them aren't that interesting though.

还有一些其他的。doc文件。但大多数都不是那么有趣。

Unfortunately I cannot recommend any other library besides libjpeg. I tried a couple of alternatives, but Libjpeg always won. Is pretty easy to work with once you have the basics done. Also it's the most complete and most stable jpeg library out there.

不幸的是,除了libjpeg,我不能推荐任何其他库。我尝试了几个替代方案,但Libjpeg总是胜出。一旦您完成了基本的工作,就很容易进行工作。它也是最完整、最稳定的jpeg库。

#2


2  

MagickWand is the C API for ImageMagick:

MagickWand是ImageMagick的C API:

http://imagemagick.org/script/magick-wand.php

http://imagemagick.org/script/magick-wand.php

I have not used it, but the documentation looks quite extensive.

我还没有使用它,但是文档看起来相当广泛。

#3


2  

You should check out Qt's QImage. It has a pretty easy interface that makes this task really easy. Setup is pretty simple for every platform.

您应该检查Qt的QImage。它有一个非常简单的界面,使得这个任务非常简单。对于每个平台,设置都非常简单。

If Qt is overkill, you can try Magick++ http://www.imagemagick.org/Magick++/. It supports similar operations and is also well suited for that sort of task. The last time I used it, I struggled a bit with dependencies for it on Windows, but don't recall much trouble on Linux.

如果Qt过高,您可以尝试Magick+ http://www.imagemagick.org/Magick+ /。它支持类似的操作,也非常适合这种任务。上次使用它时,我在Windows上与它的依赖关系上遇到了一些困难,但在Linux上不记得有什么麻烦。

For Magick++'s Image class, the function you probably want is getConstPixels.

对于Magick+ 's的图像类,您可能需要的函数是getConstPixels。

#4


1  

I have code that you can copy ( or just use as a reference ) for loading a jpeg image using the libjpeg library.

You can browse the code here: http://code.google.com/p/kgui/source/browse/trunk/kguiimage.cpp

Just look for the function LoadJPGImage.

The code is setup to handle c++ binding of my DataHandle class to it for loading the image, that way the image can be a file or data already in memory or whatever.

我有一些代码,您可以通过libjpeg库复制(或仅作为参考)来加载jpeg图像。您可以在这里浏览代码:http://code.google.com/p/kgui/source/browse/trunk/kguiimage.cpp,只需查找函数LoadJPGImage。这段代码是用来处理我的DataHandle类的c++绑定,以便加载映像,这样映像就可以是内存中已经存在的文件或数据。

#5


1  

A slightly out of the box solution is to acquire a copy of the netpbm tools, which transform images from pretty much any format to any other format via one of several very simple intermediate formats. They work well from the shell, and are most often used in pipes to read some arbitrary image, perform an operation on it, and write it out to some other format.

一种稍微与众不同的解决方案是获得netpbm工具的副本,该工具通过几种非常简单的中间格式之一将图像从几乎任何格式转换为任何其他格式。它们在shell中工作得很好,通常用于管道中读取任意图像,对其执行操作,并将其写入其他格式。

The pbm formats can be as simple as a plain ASCII header followed by the RGB data in ASCII or binary. They are intended to be simple enough to use without required a library to implement.

pbm格式可以像普通的ASCII头一样简单,后面跟着ASCII或二进制的RGB数据。它们的目的是要足够简单,以便在不需要实现库的情况下使用。

JPEG is supported in netpbm by read and write filters that are implemented on top of libjpeg.

在netpbm中,JPEG通过在libjpeg上实现的读写过滤器来支持。