代码改变世界

Read tiff from memory(从内存流读取TIFF)

2007-04-15 10:10  flyingfish  阅读(2924)  评论(1编辑  收藏  举报

 

libtiff提供的TIFFOpen函数值能够从文件打开TIFF,如果想从内存流,或者数据库中的BLOB字段读取则不是很方便,或者我们会把流存为临时的TIFF文件再打开,那显然不很经济。关于如何从内存留读取TIFF格式图像数据,在libtiff的用户共享包里有个例子,参考:

http://www.libtiff.org/contrib.html

contrib/mfs
code from Mike Johnson to read+write images in memory without modifying the library

 

该问题的一些提问请参考如下两条回复:

1、http://www.asmail.be/msg0055488938.html

Thread

2004.04.14 20:01 "Read tiff from memory", by Ann Wang

2004.04.14 21:03 "Re: Read tiff from memory", by Andrey Kiselev

2004.04.14 21:06 "Re: Read tiff from memory", by Frank Warmerdam

2004.04.14 21:03 "Re: Read tiff from memory", by Andrey Kiselev

On Wed, Apr 14, 2004 at 03:01:22PM -0500, Ann Wang wrote:
> Hi, I am a newbie and want to know if there is a way to read tiff from
> memory buffer instead of from file. Looking at the documentation, I
> only see examples reading the tiff using TIFFOpen(tiff filename,
> mode). Is there a TIFFOpen function that will read from memory buffer
> instead?
You need TIFFClientOpen() function. And contrib/mfs directory even
contains the code for working with the memory buffer.
Regards,
Andrey
--
Andrey V. Kiselev
Home phone:  +7 812 5274898  ICQ# 26871517

 

2、http://www.asmail.be/msg0055488682.html

Thread

2004.04.14 20:01 "Read tiff from memory", by Ann Wang

2004.04.14 21:03 "Re: Read tiff from memory", by Andrey Kiselev

2004.04.14 21:06 "Re: Read tiff from memory", by Frank Warmerdam

2004.04.14 21:06 "Re: Read tiff from memory", by Frank Warmerdam

Ann Wang wrote:
> Hi, I am a newbie and want to know if there is a way to read tiff from
> memory buffer instead of from file. Looking at the documentation, I only
> see examples reading the tiff using TIFFOpen(tiff filename, mode). Is
> there a TIFFOpen function that will read from memory buffer instead?
Ann,
The TIFFClientOpen() function allows you to pass in functions to be used
for seeking, reading, writing and so forth.  This can be used to access
in memory datasets.  The contrib/mfs directory contains one example of an
"in memory" access implementation using this mechanism.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

3、另:IBM网站的资料

Graphics programming with libtiff, Part 2
http://www-128.ibm.com/developerworks/linux/librar...