Hi,
in the OnImageLoaded event I save the generated thumbnails for later use on disk in a special subdir ..\_thumbs.
The size of thumbnails is always 750x500 or 500x750 pixel (images have 2:3 ratio).
I can't find the correct option to change this size, I want them smaller.
Sorry for my bad english...
Thanks for your help
Arnd Nolte
motionphotos
function ThumbFilename(AFilename: string): string;
begin
Result := TPath.Combine(ExtractFilePath(AFilename), '_thumbs');
Result := TPath.Combine(Result, ExtractFilename(AFilename));
// Result := ChangeFileExt(Result, '.bmp');
end;
procedure TFormMain.IEMView1ImageLoaded(Sender: TObject; idx: Integer);
var
IEIO: TImageEnIO;
sThumbFilename: string;
begin
// sl.Add('OnImageLoaded ' + IEMView1.ImageFileName[idx]);
sThumbFilename := ThumbFilename(IEMView1.ImageFileName[idx]);
if not System.SysUtils.FileExists(sThumbFilename) then
begin
IEIO := TImageEnIO.CreateFromBitmap(IEMView1.GetTIEBitmap(idx));
try
IEIO.Params.JPEG_Quality := 90;
ForceDirectories(ExtractFilePath(sThumbFilename));
IEIO.SaveToFile(sThumbFilename);
finally
IEIO.Free;
end;
end;
end;
procedure TFormMain.IEMView1ImageOut(Sender: TObject; idx: Integer; OutBitmap: TIEBitmap);
begin
// sl.Add('OnImageOut ' + IEMView1.ImageFileName[idx]);
OutBitmap.IECanvas.Font.Size := 24;
OutBitmap.IECanvas.DrawText(ExtractFilename(IEMView1.ImageFileName[idx]),
Rect(0, 0, OutBitmap.Width, OutBitmap.Height));
end;
procedure TFormMain.FormCreate(Sender: TObject);
begin
with IEMView1 do
begin
Align := alClient;
Parent := self;
Background := clWindow;
FlatScrollBars := True;
TextMargin := 4;
GridWidth := -1;
SelectionWidth := 1;
SelectionColor := $CEA27D;
Style := iemsFlat;
AutoAdjustStyle := False;
ThumbWidth := 150;
ThumbHeight := 150;
StoreType := ietFastThumb;
ThumbnailsBorderWidth := 0;
// ThumbnailsBorderWidth := 1;
ThumbnailsBackground := clWindow;
ThumbnailsBackgroundSelected := $FCEADA;
// ThumbnailResampleFilter := rfFastLinear;
ThumbnailResampleFilter := rfBiCubic;
ThumbnailDisplayFilter := rfFastLinear;
ThumbnailsBorderCurved := False;
HorizBorder := 2;
VertBorder := 2;
EnableMultiSelect := True;
MultiSelectionOptions := [iemoRegion, iemoOptimizeForDragging, iemoSelectOnRightClick];
DefaultTopText := iedtNone;
DefaultInfoText := iedtNone;
DefaultBottomText := iedtFilename;
BottomTextFont.Color := clGray;
BottomTextFont.Name := 'Segoe UI';
BottomTextFont.Size := 7;
SelectedFontColor := clNone;
MouseWheelParams.Action := iemwVScroll;
MouseWheelParamsAlt.Action := iemwZoom;
EnableAdjustOrientation := True;
EnableImageCaching := True;
//
OnImageOut := IEMView1ImageOut;
OnImageLoaded := IEMView1ImageLoaded;
OnImageFilename := IEMView1ImageFilename;
ImageCacheSize := 512;
LookAhead := 80;
end;
end;