• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

libtiffdelphi 3.9.1

Started by nomas, 1 September 2009, 18:24:07

Previous topic - Next topic

nomas


Galfar

Thanks, I tested it on TIFF test images I've got and no errors were found.
I'll include this to Imaging 0.26.4.

rubypdf

when does libtiffdelphi support FPC?
I successfully compiled tiff-3.9.1 and tiff-4.0.0beta4 by using GCC, but seems the modification of LibTiffDelphi.pas is still a big job.

btw, I can not include jbig support in LibTiff, I do not know why.

rubypdf

successfully compiled imaginglib with tiff support, but failed to install, got the following message:

C:\lazarus\ide\lazarus.pp(132,1) Error: Undefined symbol: _read
C:\lazarus\ide\lazarus.pp(132,1) Error: Undefined symbol: _write
C:\lazarus\ide\lazarus.pp(132,1) Error: Undefined symbol: _lseek
C:\lazarus\ide\lazarus.pp(132,1) Error: Undefined symbol: _fstat
C:\lazarus\ide\lazarus.pp(132,1) Error: Undefined symbol: _open
C:\lazarus\ide\lazarus.pp(132,1) Error: Undefined symbol: _close
C:\lazarus\ide\lazarus.pp(132,1) Error: Undefined symbol: _lfind
C:\lazarus\ide\lazarus.pp(132,1) Fatal: There were 7 errors compiling module, stopping

Galfar

These are C RTL functions which need to be linked to executable created by FPC. Some RTL functions are defined in LibDelphi.pas and LibTiffDelphi.pas but looks like these few aren't there.

You'll have to implement them on Pascal side too, or link to CRT library.

Linking to CRT is probably easier (I use this in OpenJpeg):
1) In Extras/J2KObjects is libcrtdll.a static library
2) Put {$linklib libcrtdll.a} somewhere to your Pascal code (LibTiffDelphi.pas)
3) Make sure libcrtdll.a is in FPC's library search path

Hmm do you have JPEG 2000 (OpenJpeg) support enabled in Imaging? If you do, then libcrtdll.a should already be linked to your exe.

I see you're installing Imaging as Lazarus package, what happens if you just use it in normal application? The same linking error?

Galfar

Quote from: nomas on  1 September 2009, 18:24:07
It's libtiff 3.9.1 implementation for imaginglib.

But it's not fully tested.

http://www.vdebris.comli.com/wp-content/uploads/2009/09/libtiffdelphi_3_9_1.rar


Nomas, have you included the changes made by Aware to libtiff on C side in original LibTiffDelphi sources, or it just works without them too?

rubypdf

Quote from: Galfar on 14 September 2009, 15:03:58
These are C RTL functions which need to be linked to executable created by FPC. Some RTL functions are defined in LibDelphi.pas and LibTiffDelphi.pas but looks like these few aren't there.

You'll have to implement them on Pascal side too, or link to CRT library.

Linking to CRT is probably easier (I use this in OpenJpeg):
1) In Extras/J2KObjects is libcrtdll.a static library
2) Put {$linklib libcrtdll.a} somewhere to your Pascal code (LibTiffDelphi.pas)
3) Make sure libcrtdll.a is in FPC's library search path

Hmm do you have JPEG 2000 (OpenJpeg) support enabled in Imaging? If you do, then libcrtdll.a should already be linked to your exe.

I see you're installing Imaging as Lazarus package, what happens if you just use it in normal application? The same linking error?


Yes, the same linking error when I use it in normal application.
and I use Jpeg2000 you release too, if just use Jpeg2000, it works well.
I also put {$linklib libcrtdll.a} into libtiffdelphi.pas,zlibdelphi.pas and libjpegdelphi.pas again.



rubypdf

14 September 2009, 21:15:36 #7 Last Edit: 15 September 2009, 03:02:15 by Galfar
successfully install it now, and it need
{$Linklib libmoldname} 
and successfully compile LCLImager and VampConvert, both support tiff read/write now.
it does not support attachment here, so I upload it to my blog website,

VampConvert.zip
LCLImager.zip
I think the exe is clean, and you had better to scan it before using.

I am a beginner of delphi and freepascal, and I need some time to clean source code, so no source code to download now, but if you want to help me to clean the source code, please let me know, and I give you source code and tell you how to compile it



Galfar

Good work,

I tested LCLImager you sent on various TIFFs, it works for all TIFF types I have except TIFFs that use JPEG compression. I get assertion failure in tiff_jpeg.c for these (see attached image).

Quote..., but if you want to help me to clean the source code, please let me know, and I give you source code and tell you how to compile it

Sure, send the code.

Quoteit does not support attachment here

It should work now, I moved the site to new hosting recently and there are still some issues from time to time.

Btw, have you made any modifications to libtiff C sources to get it linking/working with FPC?

rubypdf

no, I did no modification, maybe I am not link the libjpeg correctly, so it does not support jpeg, I compile it again today, support jpeg, but popup other issues.

download the source code of libzlib1.2.3, libjpeg6b, libtiff 3.9.1
compiled them under gcc 4.2+msys, and got libz.a, libjpeg.a, libtiff.a

modified zlibdelphi.pas, libjpegdelphi.pas and libdelphi.pas(learned from jpeg2000 for pascal)

To successfully compile and install, we need link more libraries,
{$linklib libmoldname}//to solve the issues I mentioned above
{$Linklib libmsvcrt}//libmsvcrt seems need libmsvcrtd.a
{$Linklib libkernel32}
{$Linklib libcrtdll} 
{$Linklib libjpeg} //seems this one need to be linked again, or does not support jpeg compressed tiff.
{$Linklib libz}

I put them in ImagingExtras.pas, or we have to put them in lazarus.pas and the project we compile, I do not know why.


I tried LibTiff4.0b3, but does not work.

Still clean the code.

rubypdf

libtiff 4.0 beta4 and jpeg-7 also works.
lclImager does not support the attched 3 tiff(uncompressed and old jpeg)
I am not test if delphi version support them or not, I am afraid it does not support either, because of the bug of imagingtiff.pas.

but I notice the imagingtiff only support 5 compress schemes, and the value seems also incorrect,
QuoteSpecifies compression scheme used when saving TIFF images. Supported values
      are 0 (Uncompressed), 1 (LZW), 2 (PackBits RLE), 3 (Deflate - ZLib), 4 (JPEG).
      Default is 1 (LZW). Note that not all images can be stored with
      JPEG compression - these images will be saved with default compression if
      JPEG is set.


but libtiff support the following compress schemes,

QuoteCOMPRESSION_NONE                    = 1;     { dump mode }
    COMPRESSION_CCITTRLE                = 2;     { CCITT modified Huffman RLE }
    COMPRESSION_CCITTFAX3               = 3;     { CCITT Group 3 fax encoding }
    COMPRESSION_CCITT_T4                = 3;       { CCITT T.4 (TIFF 6 name) }
    COMPRESSION_CCITTFAX4           = 4;      { CCITT Group 4 fax encoding }
    COMPRESSION_CCITT_T6                = 4;       { CCITT T.6 (TIFF 6 name) }
    COMPRESSION_LZW              = 5;       { Lempel-Ziv  & Welch }
    COMPRESSION_OJPEG              = 6;      { !6.0 JPEG }
    COMPRESSION_JPEG              = 7;      { %JPEG DCT compression }
    COMPRESSION_NEXT              = 32766;   { NeXT 2-bit RLE }
    COMPRESSION_CCITTRLEW           = 32771;   { #1 w/ word alignment }
    COMPRESSION_PACKBITS           = 32773;   { Macintosh RLE }
    COMPRESSION_THUNDERSCAN           = 32809;   { ThunderScan RLE }
    { codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) }
    COMPRESSION_IT8CTPAD           = 32895;   { IT8 CT w/padding }
    COMPRESSION_IT8LW              = 32896;   { IT8 Linework RLE }
    COMPRESSION_IT8MP              = 32897;   { IT8 Monochrome picture }
    COMPRESSION_IT8BL              = 32898;   { IT8 Binary line art }
    { compression codes 32908-32911 are reserved for Pixar }
    COMPRESSION_PIXARFILM           = 32908;   { Pixar companded 10bit LZW }
    COMPRESSION_PIXARLOG           = 32909;   { Pixar companded 11bit ZIP }
    COMPRESSION_DEFLATE              = 32946;   { Deflate compression }
    COMPRESSION_ADOBE_DEFLATE           = 8;       { Deflate compression, as recognized by Adobe }
    { compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> }
    COMPRESSION_DCS                     = 32947;   { Kodak DCS encoding }
    COMPRESSION_JBIG              = 34661;   { ISO JBIG }
    COMPRESSION_SGILOG              = 34676;   { SGI Log Luminance RLE }
    COMPRESSION_SGILOG24           = 34677;   { SGI Log 24-bit packed }
    COMPRESSION_JP2000                  = 34712;   { Leadtools JPEG2000 }

Galfar

These TIFFs are not loaded properly by Delphi version either (but some editors/viewers won't open them too, especially old-jpeg one).

But it's not caused by compression scheme settings - these are used only in saving and they are correctly translated to COMPRESSION_xxx constants.
See

Compressions: array[0..4] of Word = (COMPRESSION_NONE, COMPRESSION_LZW,
    COMPRESSION_PACKBITS, COMPRESSION_DEFLATE, COMPRESSION_JPEG);

in ImagingTiff.pas around line 336. I could add some more compression options there.

I see there's COMPRESSION_JP2000, do you happen to know which JPEG2000 library is used by libtiff for this (if any)?


rubypdf

have no idea about Compress_JP2000
seems freeimage support the attached images, I need confirm, but I know InfranView(also developed in delphi) support it,



http://www.ece.uvic.ca/~mdadams/jasper/

nomas

Quote from: Galfar on 14 September 2009, 15:05:34
Quote from: nomas on  1 September 2009, 18:24:07
It's libtiff 3.9.1 implementation for imaginglib.

But it's not fully tested.

http://www.vdebris.comli.com/wp-content/uploads/2009/09/libtiffdelphi_3_9_1.rar


Nomas, have you included the changes made by Aware to libtiff on C side in original LibTiffDelphi sources, or it just works without them too?



I had many changes in tif_jpeg.c and some changes on other files.

rubypdf

Quote from: nomas on 23 September 2009, 02:24:17
Quote from: Galfar on 14 September 2009, 15:05:34
Quote from: nomas on  1 September 2009, 18:24:07
It's libtiff 3.9.1 implementation for imaginglib.

But it's not fully tested.

http://www.vdebris.comli.com/wp-content/uploads/2009/09/libtiffdelphi_3_9_1.rar


Nomas, have you included the changes made by Aware to libtiff on C side in original LibTiffDelphi sources, or it just works without them too?



I had many changes in tif_jpeg.c and some changes on other files.


I got many errors when I compiled it under GCC
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:442: undefined reference to `TIFFcallvjpeg_jpeg_destroy'
.libs/tif_jpeg.o: In function `JPEGEncode':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:345: undefined reference to `TIFFcalljpeg_jpeg_write_scanlines'
.libs/tif_jpeg.o: In function `TIFFjpeg_write_raw_data':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:356: undefined reference to `TIFFcalljpeg_jpeg_write_raw_data'
.libs/tif_jpeg.o: In function `TIFFjpeg_set_colorspace':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:306: undefined reference to `TIFFcallvjpeg_jpeg_set_colorspace'
.libs/tif_jpeg.o: In function `TIFFjpeg_set_quality':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:316: undefined reference to `TIFFcallvjpeg_jpeg_set_quality'
.libs/tif_jpeg.o: In function `TIFFjpeg_error_exit':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:235: undefined reference to `TIFFjpeg_error_exit_raise'
.libs/tif_jpeg.o: In function `JPEGInitializeLibJPEG':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:288: undefined reference to `TIFFcallvjpeg_jpeg_CreateDecompress'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:274: undefined reference to `TIFFcallvjpeg_jpeg_CreateCompress'
.libs/tif_jpeg.o: In function `JPEGSetupEncode':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:297: undefined reference to `TIFFcallvjpeg_jpeg_set_defaults'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:325: undefined reference to `TIFFcallvjpeg_jpeg_suppress_tables'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:375: undefined reference to `TIFFcallvjpeg_jpeg_write_tables'
.libs/tif_jpeg.o: In function `TIFFjpeg_read_scanlines':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:403: undefined reference to `TIFFcalljpeg_jpeg_read_scanlines'
.libs/tif_jpeg.o: In function `TIFFjpeg_finish_decompress':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:424: undefined reference to `TIFFcalljpeg_jpeg_finish_decompress'
.libs/tif_jpeg.o: In function `TIFFjpeg_read_header':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:384: undefined reference to `TIFFcalljpeg_jpeg_read_header'
.libs/tif_jpeg.o: In function `JPEGDecodeRaw':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:414: undefined reference to `TIFFcalljpeg_jpeg_read_raw_data'
.libs/tif_jpeg.o: In function `TIFFjpeg_alloc_sarray':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:453: undefined reference to `TIFFcalljpeg_alloc_sarray'
.libs/tif_jpeg.o: In function `JPEGPreEncode':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:335: undefined reference to `TIFFcallvjpeg_jpeg_start_compress'
.libs/tif_jpeg.o: In function `JPEGPreDecode':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:433: undefined reference to `TIFFcallvjpeg_jpeg_abort'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:393: undefined reference to `TIFFcallvjpeg_jpeg_start_decompress'
.libs/tif_jpeg.o: In function `JPEGPostEncode':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_jpeg.c:366: undefined reference to `TIFFcallvjpeg_jpeg_finish_compress'
.libs/tif_ojpeg.o: In function `OJPEGDecode':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_ojpeg.c:785: undefined reference to `jpeg_read_raw_data_encap'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_ojpeg.c:831: undefined reference to `jpeg_read_scanlines_encap'
.libs/tif_ojpeg.o: In function `OJPEGPreDecode':
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_ojpeg.c:1115: undefined reference to `jpeg_create_decompress_encap'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_ojpeg.c:1125: undefined reference to `jpeg_read_header_encap'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_ojpeg.c:1183: undefined reference to `jpeg_start_decompress_encap'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_ojpeg.c:705: undefined reference to `jpeg_read_raw_data_encap'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_ojpeg.c:735: undefined reference to `jpeg_read_scanlines_encap'
f:/2009/tiff/gcc/imaginglib_tiff-3.9.1/libtiff/tif_ojpeg.c:711: undefined reference to `jpeg_read_raw_data_encap'
.libs/tif_ojpeg.o: In function `OJPEGLibjpegJpegSourceMgrResyncToRestart':
...

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name:
Email:

Shortcuts: ALT+S save/post or ALT+P preview

SMF spam blocked by CleanTalk