Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

TIFF Files

edited October 2005 in End User
Chaps

Is there any way that I can create a report that displays TIFF files ?

Luckily these files are not multi page TIFF's but the client has a huge
library of TIFF files that they would lile to report on.

I store the location of these files in a database and just use the
Image1.Picture.LoadFromFile function in RAP. Works a treat until it comes
across a TIFF file.

Any suggestions ?

Cheers

Mark

Comments

  • edited October 2005
    Hi Mark,

    I believe GraphicEx supports certain types of TIFF images.

    ---------------------------------------------------------------------
    Article: ReportBuilder Image Support
    ---------------------------------------------------------------------

    ReportBuilder natively supports .bmp, .jpeg, .wmf, .ico image formats.

    ReportBuilder has an open architecture that supports any TGraphic
    descendant.

    For example, ReportBuilder ships with a freeware component called GIFImage
    that can be used with ReportBuilder to print .gif images. (see the main
    report demo app for an example.)

    There is another freeware component called GraphicEx that
    supports several additional formats - including tiff, targa, and autodesk.

    It can be downloaded from:

    http://www.lischke-online.de/Graphics.php


    ReportBuilder can easily support TGraphic descendants
    with a simple register call.

    Below is the code to our ppGIF.pas unit which
    'uses' and registers the freeware GIFImage component.


    {********************************************************************}
    { }
    { ReportBuilder Report Component Library }
    { }
    { Copyright (c) 1996, 2000 Digital Metaphors Corporation }
    { }
    {********************************************************************}

    unit ppGIF;

    interface

    {$I ppIfDef.pas}

    uses
    ppCtrls, GIFImage;

    implementation

    {***************************************************************
    *
    ** I N I T I A L I Z A T I O N / F I N A L I Z A T I O N
    *
    {****************************************************************}

    initialization

    ppRegisterGraphicClass('GIF', TGIFImage);

    finalization

    ppUnRegisterGraphicClass(TGIFImage);

    end.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2005
    Nico

    Downloaded the library and just added it to a uses clause of my program (my
    End User Report main form from your demo) and now I can select from many
    more formats - great - thanks so far...

    When I use an image component now in ReportBuilder - if I select picture and
    browse to a tif I get the following message

    Cannot Load Image. The compression scheme is not supported for TIF/TIFF
    files.

    Any ideas??

    Cheers

    Mark

  • edited October 2005
    Hi Mark,

    You are going to need to create a TIFF unit that registers the TIFFImage
    component with ReportBuilder. The article I posted in my last message gives
    an example of how this is done for GIF images. You will need to do
    something similar for TIFF images.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2005
    Mark Doel is rumoured to have said:


    TIFF comes in a number of variants, and it looks like GraphicEx does
    not contain code for handling the particular compression used by your
    client.

    Paint Shop Pro can show details about an image file in its open dialog,
    and I'm sure other bitmap programs do as well. Find its TIFF version
    and the compression scheme used, and see if it is mentioned in the
    GraphicEx source, on its website, or ask in its forums.

    -tor
  • edited October 2005
    Nico

    Can you elaborate please..sorry for my misunderstanding (I am not a
    developer just dabble with report builder bits).

    What TIFFImage Component. I understand that we need to register a component
    so that we can use it in ReportBuilder.

    How do I do this with GraphicEx, have you done this before if so can you
    send me a sample ?

    Cheers

    Mark

  • edited October 2005
    Hi Mark,

    In order to allow TIFF images to show up in your reports, you will need to
    register the TTIFFImage class in the GraphiEX library with ReportBuilder
    using a format similar to the ppGIF unit already included in RB. Something
    like the following...

    unit ppTIFF;

    interface

    {$I ppIfDef.pas}

    uses
    ppCtrls, TIFFImage;

    implementation

    {***************************************************************
    *
    ** I N I T I A L I Z A T I O N / F I N A L I Z A T I O N
    *
    {****************************************************************}

    initialization

    ppRegisterGraphicClass('TIFF', TTIFFImage);

    finalization

    ppUnRegisterGraphicClass(TTIFFImage);

    end.

    Note: If you have already done this and the error still persists, take a
    look at the post by Tor Helland on this thread. He reminded me that there
    are many compression variations of the TIFF image format and only a couple
    of them are supported by the GraphiEX library. Check the GraphicEx help
    file for the TIFF types that are supported and use an imaging application
    such as PaintShop Pro to determine whether the images you are using are of
    this type and to perhaps convert them if they aren't.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2005
    Nico

    1. You do not seem to have to do the registerclass thing. Just add the
    GraphicEx unit to a pas file in the project and it all works.
    2. I tried the register class thing (The class is TTIFFGraphic) the results
    are the same so it makes no difference.

    The compression is the thing.

    I can open un-compressed TIFFS and using PhotoShop TIFF's compressed in some
    ways work others dont.

    The files I have do not open but if I change the compression and save a new
    file work.

    My next question then is

    Using RAP how can I test of the LoadFromFile has worked on the image
    component.

    If LoadFromFile works - display image if not move onto next record.

    Hopefully you can help as you have so far come up trumps!!!

    Cheers

    Mark


  • edited October 2005
    Just to complete the story

    The TIFF files I am trying to open are compressed as

    CCITT Group 4 (2d) Fax

    I cannot see this in the GraphicEx pas file.

    I will post something on their newsgroups to see if this can be supported.
    It seems a very popular compression as thousands of the files we have seem
    to use the same compression.

    I downloaded some sample files from the web and again these used this
    compression.

    I can change them but it would be nice to see if the GraphicEx comp will
    support in the future

    I will post back if I have any luck

    Cheers

    Mark


  • edited October 2005
    Hi Mark,

    Take a look at the reply Nard gave you in the RAP newsgroup. My answer to
    your question below would be very similar :).

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2005
    Nico

    I thought you may say that as just spotted his reply...;-)

    I am not a great programmer just learning and so am asking have you any
    thing that does anything similar that I can use to understand and then have
    a go at writing this thing.

    You would be saving my bacon!! ;-)

    Cheers

    Mark

  • edited October 2005
    Hi Mark,

    A Pass-Thru function in RAP is fairly simple to create. There is a full
    example of creating one inside the ReportBuilder Developer's Guide located
    in your \RBuilder\Developers Guide\... directory.

    The basic idea would be to register a new RAP function perhaps called
    "LoadTIFFImage" that returns a valid TTIFFImage. When this routine is
    called in RAP, it will execute some code in Delphi that tries to load a TIFF
    image and if the compression is incorrect, returns nil. Inside RAP, if the
    return value is nil, simply display nothing in your ppImage component,
    otherwise assign the return value to the image component.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.