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

Raf File Size.

edited March 2010 in General
We are noticing that when we save a report output to the ArchiveFile (Raf)
format and if the report has an chart as a Jpeg image in it then the size of
the Raf file is several megabytes. Of course we store the chart as a Jpeg
and not as a Bitmap. Does RB convert the Jpeg image back to Bitmap while
storing the Raf file?

If the report does not contain any charts (as jpeg images) then the RAf file
is just several KB.

Thanks,
Vikram

Comments

  • edited March 2010
    Hi Vikram,

    The Archive device simply retrieves each TppPage object (which contains all
    the DrawCommands for that page) and saves it to file using the
    TStream.WriteComponent routine. If a TppDrawImage command is present inside
    the TppPage object, it will contain a TPicture property which in turn
    references the exact TGraphic descendent you are using in the report. In
    your case this is a TJPEGImage object.

    To answer your question, ReportBuilder does not explicitly convert any
    images to Bitmaps before they are exported to an archive file. It may be
    that the TPicture objects saved with the archive contain bitmap information
    or that perhaps the addition of numerous JPEG images per page simply
    increases the file size that much.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2010
    Thanks for the response. That makes sense.

    However, we just did a quick test. We are assigning a TJpegImage to a
    TppImage like this:

    CurTppImage.Picture.Graphic.Assign(TJPEGImage(JpgList[j]));

    Then when we check the CurTppImage.Picture.Bitmap.Height it does contain the
    actual jpeg's height indicating that the Bitmap is valid and has the image
    stoed in it. This is even though we are assigning a jpeg image. This is the
    problem. Somehow the Jpeg image is getting converted to the corresponding
    Bitmap by the TppImage or TPicture or TGrpahic object thereby increasing
    the size when we print this to the Raf format.

    Also, If we do a CurTppImage.Picture.Graphic.LoadFromStream then it crashes
    with the error "Bitmap Image is not valid'.

    Appreciate your thoughts on this.

    Thanks,
    Vikram

  • edited April 2010

    The mistake in your code, you do not quite understand the architecture and
    behavior of Delphi TPicture. :)

    TPicture.Graphic is of type TGraphic, which is the abstract ancestor for
    TBitmap, TJPEGImage, etc.

    By default, TPicture.Graphic is a TBitmap. Therefore your code essentially
    does a Bitmap.Assign(myJpegImage).

    Instead try...

    myPicture.Graphic := myJPEGImage;

    To understand this, have a look at the Delphi unit, Graphics.pas, the method
    TPicture.SetGraphic.




    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2010
    We tried that but now the RAF file does not contain any image at all.
    I think there's more to this.

    Is there is a RB sample that demostrates TppImage usage?

  • edited April 2010

    The ArchiveReader application will need to include ppJpeg in the uses
    clause.

    TppImage.Picture is a of type TPicture, which is a Delphi class. Check out
    the Delphi unit, Graphics.pas, the method TPicture.SetGraphic.

    ReportBuilder Documentation for TppImage includes:

    The RBuilder help
    The Demos installed with the product.
    rbWiki


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.