views:

158

answers:

2

I'm having a proprietary image format SNG( a proprietary format) which is having a countinous array of Image data along with Image meta information in seperate HDR file.

Now I need to convert this SNG format to a Standard TIFF 6.0 Format. So I studied the TIFF format i.e. about its Header, Image File Directories( IFD's) and Stripped Image Data.

Now I have few concerns about this conversion. Please assist me.

  1. SNG Continous Data vs TIFF Stripped Data: Should I convert SNG Data to TIFF as a continous data in one Strip( data load/edit time problem?) OR make logical StripOffsets of the SNG Image data.

  2. SNG Data Header uses only necessary Meta Information, thus while converting the SNG to TIFF, some information can’t be retrieved such as NewSubFileType, Software Tag etc.

    So this raises a concern that after conversion whether any missing directory information such as NewSubFileType, Software Tag etc is necessary and sufficient condition for TIFF File.

  3. Encoding of each pixel component of RGB Sample in SNG data:

Here each SNG Image Data Strip per Pixel component is encoded as:

Out^[i] := round( LineBuffer^[i * 3] * **0.072169**  +  LineBuffer^[i * 3 + 1] * **0.715160** + LineBuffer^[i * 3+ 2]* **0.212671**); 

Only way I deduce from it is that each Pixel is represented with 3 RGB component and some coefficient is multiplied with each component to make the SNG Viewer work RGB color information of SNG Image Data. (Developer who earlier work on this left, now i am following the trace :))

Thus while converting this to TIFF, the decoding the same needs to be done. This raises a concern that the how RBG information in TIFF is produced, or better do we need this information?.

Please assist...

+1  A: 

One approach, if you have a Windows application which handles and can print this format, would be to let it do the work for you, and call it to print the file to one of the many available 'printer drivers' which support direct output to TIFF.

frogb
@frogb: Can you please add few more words about this approach...Actually this converted TIFF image is not going to be a end result. I need to do the Image manipulations on this TIFF Image.
Nains
I suggest you search for TIFF Print Driver in your search engine. Sorry, I do not have any suggestions, but there are a good number to choose from at prices ranging upwards from free. We use an OEM driver but it is only bundled with our apps (and monochome only). You probably want one with an API where you can specify the output filename and the device settings. But your success will also depend on how easy it is to control your app to select and print the file to a specified printer. Once you have a TIFF, there are also plenty of software components to manipulate it.
frogb
+1  A: 

Are you able to load this into a standard windows bitmap handle? If so, there are probably a bunch of free and commercial libraries for saving it as TIFF.

The standard for TIFF is libtiff -- it's a C library. Here's a version for Delphi made by an expert in the TIFF format:

http://www.awaresystems.be/imaging/tiff/delphi.html

There seems to be a lot of choices.

I think the approach of

  1. Loading your format into an in-memory standard bitmap (which you need to do to show it, right?)
  2. Using a pre-existing TIFF encoding library to save as TIFF

Will be a lot easier than trying to do a direct format-to-format conversion. The only reasons I wouldn't do it this way are:

  1. The bitmap is too big to keep in memory
  2. The original format is lossy and I will lose more quality in the re-encoding -- but you'd have to be saving in a standard lossy format (JPEG) to save quality.

Disclaimer: I work for Atalasoft.

We make .NET imaging codecs (including TIFF) -- that are a lot easier to use than LibTiff -- you can call them in Delphi through COM. We can convert standard windows bitmaps to TIFF or PDF (or other formats) with a couple of lines of code.

Lou Franco