ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Create individual thumbnail files
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

mvbobj

USA
14 Posts

Posted - May 08 2015 :  11:03:48  Show Profile  Reply
I have an ImageEnMView component with one or more images in it - I need to save the images as individual files and also save thumbnails of those images as individual files.

Single b&w 1 bit image currently in ImageEnMView1:

ImageEnMView1.StoreType := ietThumb;
ImageEnMView1.ThumbWidth := 116;
ImageEnMView1.ThumbHeight := 150;
ImageEnMView1.ThumbnailDisplayFilter := rfFastLinear;
ImageEnMView1.CopyToIEBitmap(0, ImageEnIO1.IEBitmap);
ImageEnIO1.Params.Assign(ImageEnMView1.MIO.Params[0]);
ImageEnIO1.SaveToFileTIFF('bwThumb.tif');

I get a 22k file that's 816+1066.

What do I need to do here? I just want to take each image and save it to a file and then save a 116x150 thumbnail to another file.

w2m

USA
1990 Posts

Posted - May 08 2015 :  12:43:47  Show Profile  Reply
Some very good and easy to use functions are in the iexHelperFunctions unit. The functions include IEConvertToThumbnail for Bitmaps and IEBitmaps that quickly produce thumbnails with various effects including border color and shadows.

You can save all the image frames in ImageEnMView as full size tif files along with jpg thumbnails for each:
procedure TForm1.CreateAndSaveAll1Click(Sender: TObject);
var
  i: Integer;
  iIEBitmap: TIEBitmap;
  iFolder: string;
  iTifFilename: string;
  iThumbnailFilename: string;
begin
  for i := 0 to ImageEnMView1.ImageCount - 1 do
  begin
    { Get the full size image from the selected ImageEnMView frame }
    iIEBitmap := ImageEnMView1.GetTIEBitmap(i);
    try
      iFolder := DesktopFolder;
      { Create the tif file filename }
      iTifFilename := iFolder +
        JustName(ImageEnMView1.MIO.Params[i].FileName) + '.tif';
      { Create the jpg thumbnail filename }
      iThumbnailFilename := iFolder +
        JustName(ImageEnMView1.MIO.Params[i].FileName) + '_thumbnail.jpg';
      { Save all images stored in ImageEnMView as full size tif files }
      iIEBitmap.IESaveToFile(iTifFilename, ioTIFF);
      { Convert the full image to a thumbnail }
      iIEBitmap.IEConvertToThumbnail(150, 116, Stretch1.Checked, rfLanczos3,
        AddBorder1.Checked, BorderColor1.Selected, AddShadow1.Checked, 0,
        StrToIntDef(ShadowOffset1.Text, 4), ShadowColor1.Selected,
        BackgroundColor1.Selected);
      { Save all thumbnails as jpg }
      iIEBitmap.IESaveToFile(iThumbnailFilename, ioJPEG);
    finally
      ImageEnMView1.ReleaseBitmap(ImageEnMView1.SelectedImage);
    end;
  end;
end;


A complete demo written with IE 6.0 and XE7 can be downloaded here: http://www.xecute.com/ieforum/topic.asp?whichpage=3&TOPIC_ID=1446#7857

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: