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

TIFF

Started by krsears, 26 May 2007, 02:39:22

Previous topic - Next topic

krsears

Just a query about the status of the TIFF code.  Are you planning to use libtiff to support this or are you going to try to code a complete TIFF engine?  In either case, how do you intend to handle multi-page TIFF's?  How do you envision changing to a different page via code?

Thanks in advance
Kendall

Galfar

26 May 2007, 13:25:16 #1 Last Edit: 27 May 2007, 22:57:26 by Galfar
Most probably I'll write native Object Pascal TIFF loader/saver. Or do you know any LibTIFF -> Pascal translation? I haven't found any.

LibTIFF would provide great support for many tiff format types but I am not sure it is worth it (considering compiling C sources on different platforms with different compilers, having object files for them, and other problems - I have had enough of this with JPEG2000).
But I will probably try it anyway and if it works I'll put LibTIFF based loader/saver to Extras extensions and look into native TIFF later (as it is really quite complex format).
Native TIFF would support raw, RLE, deflate (Zlib), LZW, and JPEG compressed images and usual color spaces (RGB, CMYK, YCC, LAB). Any special TIFF features you would like to see?

Multipage TIFFs will be handled like all other supported formats that support multiple images per file - using LoadMultiImageFromX and SaveMultiImageToX functions.

krsears

See this page: http://www.awaresystems.be/imaging/tiff/delphi.html

It is a libtiff port for Delphi.  May or may not be useful for FPC.

Specifically, I'm looking for code to allow me to display arbitrary pages from multipage TIFF's,
append Images to TIFF's, and delete page(s) from TIFF's.  Recognition and/or use of GeoTIFF tags
would be nice but not a big thing. :-)

I'm hoping to have some time to help but right now things are a bit hectic around here.

Kendall

Galfar

Yeah, I know libtiff for Delphi. Unfortunately it is not usable with FPC out of the box because of incompatible object file format. It also uses its own JpegLib and ZLib so it would greatly increase compiled binary size.
I'll try to compile original C libtiff with GCC to get FPC compatible object files. And I'll try to get it working with JpegLib and ZLib that is already included in Imaging to avoid redundancy.

For adding/removing pages from TIFF you will probably need to load whole TIFF, add/remove images from loaded array, and then save it. Loading of only one image from given index in multiimage file format is planned.

Access to some file format specific information is planned too. Like animation info in MNG files and GeoTIFF tags. I haven't look at GeoTIFF yet but I suppose it defines things like datums and reference ellipsoids?

Any help would be appreciated. Problem with native TIFF loader/saver is that there are so many compression and color schemes supported by TIFF.




Galfar

I have added experimental TIFF loading and saving support to Imaging.
It uses LibTiff for Delphi so it is currently only usable with Delphi.

Since it uses its own Jpeg and ZLib it increases executable sizes
quite a lot (nearly 400 KiB). I'll probably disable it by default in release version.   

ImagingTiff unit is located in Extras\Extensions directory. It has been
already uploaded to SVN repository along with required object files.

I will write native TIFF support later (after planned library redesign).

feherbt

Hi,

I'm using vampyre and I'am content with it.  :D
But, i need to create black and white (1BPP) TIFF (with TTiffFileFormat), but it supported only ifGray8 (min).
How I can save TIFF 1BPP?


Galfar

Hi, support for 1bit images was added to Imaging core only recently and file format handlers were not updated yet. Wait a while please.
Are you interested in any of the 1bpp compression schemes supported by TIFF?

feherbt

Hi,
(first of all, sorry for my weak english  :D)
what do you think, how long does it take to upload the new wersion?
I would be grateful to you for it.  :)

Yes I'am interested in 1bpp, because i need to store a lot of multipages scanned documents.

Thank you very much for effort.

Galfar

1bpp image data format support (convert to/from other formats) is already in the version that's in SVN repository. I don't know when I'll have time to extending it with TIFF 1bpp saving, although it's quite easy.

Galfar

1bpp support was just added to PNG file format handler and  TIFF support is next in the line.

Galfar

Ok, TIFF 1bpp support is done and uploaded to SVN.

feherbt

Thank you for your work.
I try to get in touch with SVN as soon as I can, going to test 1bpp and tell you about it.
Thanks again. :)

feherbt

I have tested and working correctly!  :)
Many thanks again!
Quote from: Galfar on  6 September 2010, 23:11:22
Ok, TIFF 1bpp support is done and uploaded to SVN.

feherbt

One more question (Like Columbo's "one more thing")  :)

I'm using the TIFF 1bpp and it seems ok, but when the file opened with microsoft imaging the result is negative (with IrfanView is ok).

I have no idea!  :-[
Any suggestion?
Thank

Quote from: feherbt on  7 September 2010, 17:03:21
I have tested and working correctly!  :)
Many thanks again!
Quote from: Galfar on  6 September 2010, 23:11:22
Ok, TIFF 1bpp support is done and uploaded to SVN.


Galfar

5 July 2011, 18:14:24 #14 Last Edit: 5 July 2011, 18:35:53 by Galfar
There are TIFF tags PHOTOMETRIC_MINISBLACK and PHOTOMETRIC_MINISWHITE
which tell the decoder if pixel with value 0 is black or white.
Look's like Imaging does not set the tag for binary images and the decoder programs
assume some default. The default for Irfan and MS Imaging is probably different.
I'll update the TIFF writer to set the tag explicitly.

EDIT: So it looks like there's some bug in MS Office Document Imaging that ignores the
PHOTOMETRIC_MINISBLACK tag. Binary images are always assumed to be PHOTOMETRIC_MINISWHITE.
Other MS programs (Paint, Explorer, ...) handle binary TIFFs saved by Imaging correctly.

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