TIFF File Formats

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's Image-XChange Imaging SDK (only).

Moderators: Tracker Support, TrackerSupp-Daniel, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker - Clarion Support, John - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Support Staff, moderators

Post Reply
jeffp
User
Posts: 854
Joined: Wed Sep 30, 2009 6:53 pm

TIFF File Formats

Post by jeffp » Sat Feb 27, 2010 8:52 pm

Does the Image XChange Library give me the ability to change file formats. For example, I need to save out an image to file as BW TIFF with CCIT compression regardless of the original format.

Also, can I convert a .bmp or a .jpet to .tiff, and vice versa.

Lzcat - Tracker Supp
Site Admin
Posts: 711
Joined: Thu Jun 28, 2007 8:42 am

Re: TIFF File Formats

Post by Lzcat - Tracker Supp » Mon Mar 01, 2010 7:30 am

Answer is "Yes, it does" for all questions. You can find working sample with installation (including sources). Also please see IMG_PageSetFormatLongParameter and similar functions. And if you will have more questions - you are wellcome.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.

jeffp
User
Posts: 854
Joined: Wed Sep 30, 2009 6:53 pm

Re: TIFF File Formats

Post by jeffp » Tue Mar 02, 2010 12:01 am

I've looked at the help topic for IMG_PageSetFormatLongParameter and figured it had to do with the id and value properties, but the help doesn't give any more info on id and value and their possible values.

I looked around for some Delphi examples but can't find then in the SDK. Can you direct me to the right Delphi examples for this. I'm sure I'm just missing it somewhere.

Thanks.

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Re: TIFF File Formats

Post by John - Tracker Supp » Tue Mar 02, 2010 5:11 am

There is only the one Delphi example Jeff and not being a Delphi DEV I cannot advise specifically - but here is the example in case you missed it ..
Attachments
DelphiExamples.7z
(31.32 KiB) Downloaded 230 times
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

jeffp
User
Posts: 854
Joined: Wed Sep 30, 2009 6:53 pm

Re: TIFF File Formats

Post by jeffp » Tue Mar 02, 2010 2:57 pm

Yes. I did see this example, but I didn't find anyting in it that will help me with the conversion of file formats and the use of the IMG_PageSetFormatLongParameter call. Am I missing something?

Is that more explanation of the id and value properties in IMG_PageSetFormatLongParameter somewhere?

Lzcat - Tracker Supp
Site Admin
Posts: 711
Joined: Thu Jun 28, 2007 8:42 am

Re: TIFF File Formats

Post by Lzcat - Tracker Supp » Tue Mar 02, 2010 5:17 pm

I'm afraid not, at least at the moment. And I'm afraid that the Delphi sample is not good enough to illustrate fully all the Image-XChange possibilities.

Better to look I would suggest at the C++ sample named ImagesTest, especially the file encoders_dlg.cpp - there is code there which interprets format-specific parameters (see the following explanation).

Image-XChange was designed to support different formats, so it does not contain any format-specific functions like SaveTiffFile etc. Instead we decided that each page (yes, page, not image) contains a list of properties, identified by an ID. Each property has a fixed type (int, double, string), and a page can have any set/combination of them.

When format-specific code (located in the format dll, outside of the Image-XChange core) reads a page from a file it fills all possible properties for each page. And when such code tries to save a file it examines all pages and checks for the specified properties - some of properties will be ignored (if format does not support them), some of them will be corrected (if invalid values are set), and then saves the file.

Since the Image-XChange core and likely the user know almost nothing about format-specific properties - each format library provides a structure which describes all supported properties and their types. In addition for the save structure it is a bit more complex - to contain format-specific dependencies between properties.

There is a good example of how to deal with such structures - decoders_dlg.cpp (for a description of the full properties, see IMG_GetFormatOpenParams function) and encoders_dlg.cpp mentioned above (description for the properties supported when save is set, see the IMG_GetFormatSaveParams function).

In truth - the properties set is almost the same, except some of them cannot be acquired during reading (e.g. compression level). Properties are set as un-unified (and cannot be unified), however we try to keep a minimal set of them.

Also, there are two properties that are present in all formats:

FP_ID_FORMAT - contains the file format identifier; present when read, required for save
FP_ID_ITYPE - contains the image type (unified list of image types, not all formats support all possible values); required for a 'save'

To see all supported properties for a specific format you may run the ImagesTest app and select the Decoders list and Encoders list from the View submenu.

For example if you want to save a multi-page image to a tiff file, black and white and with CCITT compression you should set as below : (for ALL pages):

FP_ID_FORMAT to FMT_TIFF_ID
FP_ID_ITYPE to ImageFormat_BlackAndWhite_1
FP_ID_COMP_TYPE to opne of IComp_CCITTRLE, IComp_CCITTFax3, IComp_CCITTFax4, or IComp_CCITTRLEW

Possibly looks a little complex, but we haven't found a simpler and more flexible way.
HTH.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.

jeffp
User
Posts: 854
Joined: Wed Sep 30, 2009 6:53 pm

Re: TIFF File Formats

Post by jeffp » Tue Mar 02, 2010 5:45 pm

Thanks Victor. I like your approach. And I'll install the C++ exmaples and take a look for more deatails.

But I assume the call would be something like this for all pages:

IMG_PageSetFormatLongParameter(page, FP_ID_FORMAT, FMT_TIFF_ID);
IMG_PageSetFormatLongParameter(page, FP_ID_ITYPE, ImageFormat_BlackAndWhite_1);
IMG_PageSetFormatLongParameter(page, FP_ID_COMP_TYPE, IComp_CCITTFax4);

Then I would just call IMG_ImageSaveToFile to save the file out to disk.

This begs the question then, where are all the ID and Values defined. Shouldn't they be in some .pas unit?

Lzcat - Tracker Supp
Site Admin
Posts: 711
Joined: Thu Jun 28, 2007 8:42 am

Re: TIFF File Formats

Post by Lzcat - Tracker Supp » Tue Mar 02, 2010 6:46 pm

Yes, your are correct with function calls :)
ID's and values are defined in C++ headers (.h files), supplied with the examples, and I'm afraid that not all of them are translated to Delphi. Please see the file ixcfmtdefs.h (hope you can read C++ notation).

Thanks !
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.

jeffp
User
Posts: 854
Joined: Wed Sep 30, 2009 6:53 pm

Re: TIFF File Formats

Post by jeffp » Tue Mar 02, 2010 7:43 pm

Perfect. Thanks much. I know how to take it from here.

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Re: TIFF File Formats

Post by John - Tracker Supp » Tue Mar 02, 2010 9:11 pm

Hi Jeff,

as you can see from the above Victor (Lazycat) knows his stuff - even if the message needs a little understanding sometimes, hence the reason I have corrected the syntax and formatting a little - but the info is all there ! (Thanks Victor:) )
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

jeffp
User
Posts: 854
Joined: Wed Sep 30, 2009 6:53 pm

Re: TIFF File Formats

Post by jeffp » Tue Mar 02, 2010 9:19 pm

No worries. The quality of your product is proof enough you know your stuff. I understand the posts just fine. I've worked with enough overseas developers to know not to read anything into broken English. I'm sure my Russian, French, or Canadian <g> would be much worse.

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Re: TIFF File Formats

Post by John - Tracker Supp » Tue Mar 02, 2010 10:57 pm

Appreciate your understanding Jeff and whilst I have an excellent understanding of profanity in many languages - my useful, general and technical vocabulary is almost non-existent ;)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

Post Reply