Author |
Topic |
|
skippix
USA
68 Posts |
Posted - Feb 27 2018 : 07:14:23
|
I've found a handful of threads about combining images, but not anything that gets me close to what I need to do, and that is create custom contact sheets such as what can be produced in Lightroom:
After specifying a page size, I need to be able to specify the number of rows, columns, margins, etc
Is this possible? The end result could be anything - a jpg, a pdf, a multi-layered tiff - it doesn't matter, as long as it's printable.
I think I can handle the math for the sizing and ratios; it's just a matter of getting the images combined.
Thanks!
|
|
w2m
USA
1990 Posts |
Posted - Feb 27 2018 : 12:14:20
|
Try ImageEnMView1.MIO.PreviewPrintImages or iexWindowsFunctions.ShowWindowsPrintWizard(ImageEnMView1, True);
TImageEnMIO.PreviewPrintImages
Declaration
procedure PreviewPrintImages(DestBitmap: TBitmap; MaxBitmapWidth, MaxBitmapHeight: integer; PrinterObj: TPrinter; Columns: integer; Rows: integer; HorizSpace: double; VertSpace: double; PrintSelected: boolean; MarginLeft: double; MarginTop: double; MarginRight: double; MarginBottom: double; DrawBox: boolean; DrawText: boolean; DrawShadow: boolean; BoxColor: TColor = clBlack; iPageNo : Integer = 0);
Description
Display a preview of printing of images (all or just selected) in the attached TImageEnMView or TIEMultiBitmap as rows and columns of thumbnails.
Parameter Description DestBitmap Destination bitmap where to paint the preview. Resizes DestBitmap as needed. MaxBitmapWidth Maximum destination bitmap width. Preview will be stretched to match this size. MaxBitmapHeight Maximum destination bitmap height. Preview will be stretched to match this size. Printer This is the Printer object. PreviewPrintImage need it to know printer settings as orientation or page sizes. Columns Specifies how arrange images, specifying the number of columns. Rows Specifies how arrange images, specifying the number of rows. HorizSpace The horizontal space in inches between images. VertSpace The vertical space in inches between images. PrintSelected Set to true to print only selected images. MarginLeft Page left margin in inches. By specifying all zero values, no margins are used. MarginTop Page top margin in inches. By specifying all zero values, no margins are used. MarginRight Page right margin in inches. By specifying all zero values, no margins are used. MarginBottom Page bottom margin in inches. By specifying all zero values, no margins are used. DrawBox Set to true to draw a box around the images (image space). Image is always stretched to maintain aspect ratio. DrawText Set to true to draw text associated with every image. DrawShadow Set to true to draw a shadow around the image. BoxColor Specifies the color of the box around the image if DrawBox is True. iPageNo The page of thumbnails to preview. 0 shows the first page, 1 the second, etc.
Example
// Paint and display the preview of thumbnails of the ImageEnMView using a TImageEnView component ImageEnMView1.MIO.PreviewPrintImages(ImageEnView2.IEBitmap.VclBitmap, ImageEnView2.Width, ImageEnView2.Height, Printer, 6, 4, ...);
procedure TFormPrintPreview.PaintThumbnails;
var
iMaxBitmapWidth: Integer;
{ Maximum destination bitmap width. Preview will be stretched
to match this size }
iMaxBitmapHeight: Integer;
{ Maximum destination bitmap height. Preview will be stretched
to match this size. }
iPrinter: TPrinter;
{ This is the Printer object. PreviewPrintImage need it to know
printer settings as orientation or page sizes. }
iColumns: Integer; { Specifies how arrange images, specifying the number of
columns. }
iRows: Integer;
{ Specifies how arrange images, specifying the number of rows. }
iHorizSpace: double; { The horizontal space in inches between images. }
iVertSpace: double; { The vertical space in inches between images. }
iPrintSelected: Boolean; { Set to true to print only selected images. }
iMarginLeft: double;
{ Page left margin in inches. By specifying all zero values, no
margins are used. }
iMarginTop: double;
{ Page top margin in inches. By specifying all zero values, no margins
are used. }
iMarginRight: double;
{ Page right margin in inches. By specifying all zero values, no
margins are used. }
iMarginBottom: double;
{ Page bottom margin in inches. By specifying all zero values,
no margins are used. }
iDrawBox: Boolean;
{ Set to true to draw a box around the images (image space). Image is
always stretched to maintain aspect ratio. }
iDrawText: Boolean; { Set to true to draw text associated with every image. }
iDrawShadow: Boolean; { Set to true to draw a shadow around the image. }
iBoxColor: TColor;
{ Specifies the color of the box around the image if DrawBox
is True. }
iPageNo: Integer;
{ The page of thumbnails to preview. 0 shows the first page, 1 the second, etc. }
iPages: double;
iCells: Integer;
begin
iMaxBitmapWidth := ImageEnView1.IEBitmap.Width;
iMaxBitmapHeight := ImageEnView1.IEBitmap.Height;
iPrinter := Printer;
iColumns := StrToIntDef(Columns1.Text, 2);
iRows := StrToIntDef(Rows1.Text, 2);
iHorizSpace := IEStrToFloatDefS(HorizSpace1.Text, 0);
iVertSpace := IEStrToFloatDefS(VertSpace1.Text, 0);
iPrintSelected := DisplaySelected1.Checked;
iMarginLeft := IEStrToFloatDefS(VertSpace1.Text, 0);
iMarginTop := IEStrToFloatDefS(VertSpace1.Text, 0);
iMarginRight := StrToIntDef(VertSpace1.Text, 0);
iMarginBottom := StrToIntDef(VertSpace1.Text, 0);
iDrawBox := DrawBox1.Checked;
iDrawText := DrawText1.Checked;
iDrawShadow := DrawShadow1.Checked;
iBoxColor := BoxColor1.Color;
iPageNo := StrToIntDef(Page1.Text, 0) - 1;
iCells := iRows * iColumns;
ImageEnMView1.MIO.PreviewPrintImages(ImageEnView1.Bitmap, iMaxBitmapWidth,
iMaxBitmapHeight, iPrinter, iColumns, iRows, iHorizSpace, iVertSpace,
iPrintSelected, iMarginLeft, iMarginTop, iMarginRight, iMarginBottom,
iDrawBox, iDrawText, iDrawShadow, iBoxColor, iPageNo);
ImageEnView1.Update;
if iPrintSelected then
iPages := ImageEnMView1.MultiSelectedImagesCount / iCells
else
iPages := ImageEnMView1.ImageCount / iCells;
if (iPages = 0) and (iCells > 0) then
iPages := 1;
UpDown3.Max := Round(iPages);
UpDown3.Min := 1;
Caption := 'Print Preview Page ' + IntToStr(iPageNo + 1) + ' of ' +
IntToStr(Round(iPages));
Previous1.Enabled := iPageNo <> 0;
Next1.Enabled := UpDown3.Position <> UpDown3.Max;
end; Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
|
|
xequte
38196 Posts |
Posted - Feb 27 2018 : 13:28:00
|
Thanks Bill, I should really create a demo for this...
Nigel Xequte Software www.imageen.com
|
|
|
skippix
USA
68 Posts |
Posted - Feb 27 2018 : 16:19:28
|
I'll give that a try, thanks!
And YES, a demo would be great! :D |
|
|
skippix
USA
68 Posts |
Posted - Feb 27 2018 : 16:37:53
|
Looks like I'll need a demo. Can't get Bill's code to work as it is. |
|
|
w2m
USA
1990 Posts |
Posted - Feb 28 2018 : 10:00:38
|
Nigel,
I emailed you a demo for you look at. The PreviewPrintImages procedure allows drawing text as well the image, but how is the text set (the text string) and can the font.name, font.size and font.color be changed as well? When I look over the IE source code it seems like the text is supplied to the procedure from the ImageEnMView1.ImageTopText[i] but no text is drawn in the demo.
Also, the dimensions of the thumbnails in the PreviewPrintImages procedure depend on the TBitmap dimensions and the horizontal and vertical spacing so it is difficult to get the thumbnail dimensions the user desires.
I suggest an overloaded procedure be developed that gives priority to thumbnail width and height in it's drawing code, as well as providing parameters for the text string and text font so the text can be drawn and the dimensions of the thumbnail can be specifically controlled.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
|
|
xequte
38196 Posts |
|
Uwe
284 Posts |
Posted - Mar 13 2018 : 13:42:17
|
Nigel, is there a chance that we could get a "PrintImagesToStream" procedure, too? I would like to load the contact sheet to a stream and then display it directly in an ImageEnView.
-Uwe |
|
|
w2m
USA
1990 Posts |
Posted - Mar 13 2018 : 13:47:42
|
Also, when bDrawText is set to true to draw text associated with every image. There is no text property for the text associated with every image and there is nothing that describes where the text is obtained.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
|
|
xequte
38196 Posts |
Posted - Mar 13 2018 : 14:58:54
|
Hi
I am working on an update now that will provide output to bitmap (PrintFilesToBitmap) and better text handling.
@Uwe: I'm not sure about stream output, because it would still need to be called for each "page" of the image sheets. Can you describe your requirement.
Nigel Xequte Software www.imageen.com
|
|
|
xequte
38196 Posts |
Posted - Mar 15 2018 : 14:58:12
|
Hi
I've created a new demo for contact sheet output, though to use it you'll need a pre-release of 7.5.1. Email me if you want a download of both.
Nigel Xequte Software www.imageen.com
|
|
|
w2m
USA
1990 Posts |
Posted - Mar 21 2018 : 09:47:00
|
Nigel,
I requested the demo and update via email a few days ago, but no reply.
Thanks.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
|
|
xequte
38196 Posts |
Posted - Mar 21 2018 : 21:50:26
|
Sorry Bill,
I haven't received your email. Did you use nigel@xequte.com?
I've emailed you the demo source.
Nigel Xequte Software www.imageen.com
|
|
|
|
Topic |
|
|
|