Is there a limit on DBImage data size
I have a 100 page report with some 50 DBimages per page. Is there a limit on the JPEG size from the database? Some are small 50K whereas some are3MB. The program crashes randomly. Does the JPEG data get drawn on the image and effectively get compressed, and can one alter the compression? Sometimes I get "insufficient memory". Should I use a lain image and shrink the JPEG before loading it into the image?
Comments
Load the report definition (if stored in file or database).
Try setting Report.PreviewFormSettings.SinglePageOnly to True and Report.ThumbnailSettings.Enabled to False and Report.CachePages to False.
Save the report definition.
Test the report. If the issue persists, try shrinking the images.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I suggest using a TppImage and manually loading the processed image data for each record.
1. Load the image data from your DB into a stream (using DataPipeline.GetFieldAsStream).
2. Process the image data.
3. Load the processed data into the TppImage.Picture
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
// expose the protected properties
type
TlbkPicture = class(TPicture)
end;
{ get a JPG }
oJpg := TJpegImage.Create;
oStream := TMemoryStream.Create;
oStream.Write(sData[1],Length(sData));
oStream.Position := 0;
oJpg.LoadFromStream(oStream);
oStream.Free;
oBmp := TBitMap.Create;
oBmp.Width := iSize;
oBmp.Height:= iSize;
oBmp.Canvas.StretchDraw(oBmp.Canvas.ClipRect,oJpg);
oJPG.Free;
{ get the bitmap stream }
oStream := TMemoryStream.Create;
oBmp.SavetoStream(oStream);
oBmp.Free;
oStream.Position := 0;
TlbkPicture(oImage.Picture).LoadFromStream(oStream);
Is there a faster way?
Lawrence
This looks fine except there is likely no need to recreate the memory stream to assign the graphic. Assigning the oBmp bitmap to the Picture.Graphic should also work.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com