Quality Software Components
 

Home

Products
  ImageEn
 
    Features
     What's new
     Screen shots
     FAQ                   
  ImageEn ActiveX
  IEvolution (.Net)
  ImageEn ASP

Buy

Downloads

Resellers

Links

Contacts

Users Community

Login

 

 

 

 

 

ImageEn Frequently Asked Questions and Answers



 

Where are ImageEn samples?



Look here


 

How can I prevent the scrollwheel from causing the image to zoom? I want it to remain the orginal size at all times.



Just write:

ImageEnView1.MouseWheelParams.Action:=iemwNone;

other values are iemwVScroll and iemwZoom (default).


 

I was wondering if it was possible to convert, say, a GIF image to a TIFF image without a visual component. In other words, how could I convert among image formats in a console application?



There are several ways. The simplest is:

var
  ie:TImageEnView;
begin
  ie:=TImageEnView.Create(nil);
  ie.IO.LoadFromFile('in.gif');
  ie.IO.SaveToFile('out.gif');
  ie.free;
end;


 

You can also create a TIEBitmap (or TBitmap) object that contains the image. This is the code:




var
  bmp:TIEBitmap;
  io:TImageEnIO;
Begin
  bmp:=TIEBitmap.Create;
  io:=TImageEnIO.Create(self);
  io.AttachedIEBitmap:=bmp;
  io.LoadFromFile('in.gif');
  io.SaveToFile('out.gif');
  io.free;
  bmp.free;
End;


 

Can I modify brightness?



You can change brightness (luminosity) using several methods.

Using IntensityRGBall method:

  ImageEnView1.Proc.IntensityRGBall(20,20,20); // increment luminosity of 20 (the fastest)

Using HSLvar method:

  ImageEnView1.Proc.HSLvar(0,0,20); // increment luminosity of 20 (slow but more accurate)

Using HSVvar method:

  ImageEnView1.Proc.HSVvar(0,0,20); // increment luminosity of 20 (slow but more accurate)


 

Can I modify scanner resolution?



To change scan resolution to 300 on your scanner use:

ImageEnView1.IO. TWainParams.XResolution.CurrentValue:=300;
ImageEnView1.IO.TWainParams.YResolution.CurrentValue:=300;
ImageEnView1.IO.Acquire;


 

Is there any way to save a CMYK tif using ImageEn?



To save TIFF with CMYK write:

ImageEnView1.IO.Params.TIFF_PhotometInterpret:=ioTIFF_CMYK;

ImageEnView1.IO.SaveToFile('xxx.tif');


 

I want to resample a normal picture but i've got everytime the same compiler error : TResampleFilter.... is not definied.



You have to add to the "uses" list the "hyiedefs" unit:

uses hyiedefs;


 

Is it possible to de/activate duplex on scanner ?



Write ImageEnView1.IO.TWainParams.DuplexEnabled:=True (or False if you want disable).


 

I'm trying to insert some text (the current time) in the raw frame using the event OnVideoFrameRaw , my question is : how can I get a canvas from the parameters passed to this event ?



Instead of use OnVideoFrameRaw you have to use OnVideoFrame that returns a Bitmap object.

From Bitmap object you can obtain the Canvas with:

Bitmap.Canvas


 

Can your component take a series of single page TIFF files and create a Multi-Page file from them?



You can load the page using:

  ImageEnView1.IO.LoadFromFile('page1.tif');

then save the page with:

  ImageEnView1.IO.Params.TIFF_ImageIndex:=0; // increment this for each page

  ImageEnView1.IO.InsertToFileTIFF('multipage.tif');

Otherwise you can use TImageEnMView and TImageEnMIO component. See "multi" example for more details.


 

How to change the current page of a TIFF image in ImageEn, or do I use another control?



In order to load several pages from a TIFF you have two ways:

1) load a page at the time, using TImageEnView, example:

ImageEnView1.IO.Params.TIFF_ImageIndex:= page_number; // page_number stars from 0 (first page)

ImageEnView1.IO.LoadFromFile('mytiff.tiff');

First instruction select the page to load. To know how many pages there are use:

page_count:=EnumTIFFIm('mytiff.tiff');

2) load all pages, using TImageEnMView. Just write:

ImageEnMView1.MIO.LoadFromFile('mytiff.tiff');

and you will see all pages.



 

I have downloaded some of your components and its format is MSI. Unfortunately i dont know how i can install it.



First download updated Windows Installer from Microsoft:

(for NT and 2000)

Then just double click on the MSI file.


 

Is it possible, using ImageEn, to convert a multipage-image to a different encoding? G3 and G4 specifically?



Using TImageEnMView you have to change the compression property for all pages:

ImageEnMView1.MIO.LoadFromFile('original.tif');
// change compression for the first page
ImageEnMView1.MIO.Params[0].TIFF_Compression := ioTIFF_G4FAX;
// change compression for the other pages
ImageEnMView1.MIO.DuplicateCompressionInfo;
// now save
ImageEnMView1.Mio.SaveToFile('output.tif');


 

How do I get the transparent PNGs to work inside your vector view control?



To load the alpha channel from PNG (and others) you have to use SetObjBitmapFromFile method:

ImageEnVect1.SetObjBitmapFromFile(hobj, 'test.png');


 

I would like users to be able to resize and move vectorial objects when they are displayed on the screen. Is it possible ? How can I do that ?



To enable users to modify (move,resize) objects just set:

ImageEnVect1.MouseInteractVt:=[miObjectSelect];

The users can select then modify objects.


 

Using TImageEnMView, how display images "on demand"?



There are several ways to display images "on demand":

1) If you have a directory where are all files just write:
ImageEnMView1.FillFromDirectory('c:\myimages');

2) When you add a new image just set ImageFileName[] index, and ImageEn will load automatically specified file when needed. Example:

idx:=ImageEnMView1.AppendImage;
ImageEnMView1.ImageFileName[idx]:='first.jpg';

3) When you add a new image just set the ImageID[] property. You have to create by hand an array of filenames where to get images. Example:

var
  files:array [0..1] of string;
begin
  files[0]:='first.jpg';
  files[1]:='second.jpg';
  ImageEnMView1.ImageID[ ImageEnMView1.AppendImage ] := 0;
  ImageEnMView1.ImageID[ ImageEnMView1.AppendImage ] := 1;
end;

You have also to create OnImageIDRequest event, on this you can write:

procedure TForm1.OnImageIDRequest(Sender: TObject; ID:integer; var Bitmap:TBitmap);
var
  io:TImageEnIO;
begin
  io:=TImageEnIO.Create(self);
  io.AttachedBitmap:=bmp; // bmp is a TBitmap object, defined at class level (must exists after the OnImageIDRequest exits)
  io.LoadFromFile( files[ID] );
  io.free;
  Bitmap:=bmp;
end;

4) If the images are frames of a media file (like AVI, MPEG, etc..) you can write:

ImageEnMView1.LoadFromFileOnDemand('film.mpeg');


 

We tried to install using the given user name/registration number but we still get the nag reminder saying that this is a demo.



Probably you have still an unregistered version of ImageEn in the Delphi paths. Remove old ImageEn files (also in Windows\System32 directory searching for pkie*.* files) and reinstall ImageEn.


 

Is it possible to save the Lines,Ellipses .... into the image ? Burn into the jpg file ?



Use CopyObjectsToBack method, then save the background image.


 

How do i load / change the IPTC info without loading the original image?



To load IPTC info from a jpeg, just use LoadFromFile method. After this you have in ImageEnView.IO.Params.IPTC_Info object all IPTC informations loaded. To read the caption you can write:

ImageEnView.IO.LoadFromFile('image.jpg');
Idx:=ImageEnView.IO. Params.IPTC_Info.IndexOf(2,120);
Caption:= ImageEnView.IO.Params.IPTC_Info.StringItem[idx];

this modify the caption:

ImageEnView.IO.Params.IPTC_Info.StringItem[idx] := 'new caption';
ImageEnView.IO.SaveToFile('image2.jpg');

If you want to modify IPTC info without load the image use ParamsFromFile and InjectJpegIPTC methods, in this way:

ImageEnView.IO.ParamsFromFile('one.jpg');

...here modify the IPTC info

ImageEnView.IO.InjectJpegIPTC('two.jpg');


 

We need to print all the 'pages' in a multipage tiff.



You can connect a TImageEnIO to a TImageEnMView. TImageEnIO.PrintImage will print the selected image (use SelectedImage to change current selected image). In this way you can print all pages:

for i:=0 to ImageEnMView1.ImageCount-1 do
begin
  ImageEnMView1.SeletedImage := i;
  ImageEnIO.PrintImage...
end;

You can also use the predefined dialog of TImageEnMView componet. Just write:

ImageEnMView.MIO.DoPrintPreviewDialog;


 

How I can save my jpeg without EXIF or other metadata?



Call Params.ResetInfo. Example:

ImageEnView.IO.LoadFromFile('input.jpg');
ImageEnView.IO.Params.ResetInfo;
ImageEnView.IO.SaveToFile('output.jpg');


 

I have a question. How can I check if the TImageEnView is empty (no bitmap loaded)?



To empty the component use "Blank" method. To check if it is empty use IsEmpty:

If ImageEnView1.IsEmpty then
...


 

What I need to do is, when a user selects a page of the multipage tiff image (using TImageEnMView) this image should be copied/displayed on ImageEnView1.



To handle image selection use OnImageSelect event. To transfer current selected image use simply the Assign method:

procedure TForm1.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
  ImageEnView1.Assign( ImageEnMView1.Bitmap );
end;


 

How is it possible to assign the image in one ImageEnView to another ImageEnView?



Just use Assign method:

ImageEnView1.Assign( ImageEnView2 );

or

ImageEnView1.Assign( ImageEnView1.Bitmap ); // this doesn't copy DPI, but just the image


 

Which is the correct way to load a Resource Image at runtime into an TImageEnView component, in C++?



Here is a sample code:

    TResourceStream *ResourceImage;
    // Load from resource the About image ( a JPEG file).
    ResourceImage = new TResourceStream((int)HInstance, "ABOUTBITMAP",RT_RCDATA);
    MainForm->ImageAbout->IO->LoadFromStreamJpeg(ResourceImage);
    delete ResourceImage;


Here is a single line text file named "resource.rc" with the sentence:

ABOUTBITMAP RCDATA "about.jpg"

Just add the Resource file to the project and compile.


 

How read custom TIFF tags?



This example shows how read EXIF tags saved with Canon cameras:

var
  ms:TMemoryStream;
  tagReader1,tagReader2,tagReader3:TIETifTagsReader;
  i:integer;
  // some Canon tags
  m_nMacroMode,m_nLenghtTimer,m_Quality:integer;
  m_ImageType:string;
begin
  with imageenvect1 do begin

    IO.LoadFromFile('Capture_00006.JPG');
    with IO.Params.JPEG_MarkerList do begin
      i:=IndexOf( JPEG_APP1 );
      if i>=0 then begin
        // there are EXIF info
        ms:=TMemoryStream.Create;
        ms.Write( MarkerData[i][6], MarkerLength[i] ); // bypass first 4 bytes (must contain 'Exif')
        ms.Position:=0;

        tagReader1:= TIETifTagsReader.CreateFromStream( ms,0 ); // read TIFF's IFD

        tagReader2:= TIETifTagsReader.CreateFromIFD( tagReader1, 34665 ); // read IFD in tag 34665 (SubEXIF)

        tagReader3:= TIETifTagsReader.CreateFromIFD( tagReader2, $927c ); // read IFD in tag $927C (MarkerData - Canon IFD data)

        // read Canon EXIF tags
        m_nMacroMode:=tagReader3.GetIntegerIndexed(1,1);
        m_nLenghtTimer:=tagReader3.GetIntegerIndexed(1,2);
        m_Quality:=tagReader3.GetIntegerIndexed(1,3);
        m_ImageType:=tagReader3.GetString(6);

        tagReader3.Free;
        tagReader2.Free;
        tagReader1.Free;

        ms.Free;
      end;
    end;
  end;
end;


 

Why my jpegs are so big?



Jpeg is a file format with variable compression rate. The property that regulates the compression (and the quality) is JPEG_Quality. So you should set this property before save. Example:

ImageEnView.IO.LoadFromFile('input.jpg');
ImageEnView.IO.Params.JPEG_Quality:=70;
ImageEnView.IO.SaveToFile('output.jpg');

The default is 80, while other software uses 70.
If you want estimate the value used to create your file, execute this:
quality:=IECalcJpegFileQuality('input.jpg');

So you could write:

ImageEnView.IO.LoadFromFile('input.jpg');
ImageEnView.IO.Params.JPEG_Quality:=IECalcJpegFileQuality('input.jpg');
ImageEnView.IO.SaveToFile('output.jpg');

If this is not enough, probably the file contains metatags (text info). To remove them execute:

ImageEnView.IO.Params.ResetInfo;

..just before save.


 

In ImageEnVect, how to save a image with many objects? And how can I load the objects if I'd saved them?



here is all options of ImageEn:

1)
if you want to save only objects:

ImageEnVect1.SaveToFileIEV('file.iev');

to load back:

ImageEnVect1.LoadfromFileIEV('file.iev');


2)
If you want save objects and image:

ImageEnVect1.SaveToFileAll('file.all');

and to load:

ImageEnVect1.LoadFromFileAll('file.all');

3)
If you want save objects and image as standard tiff and using Imaging Annotations (readable by Windows Preview):

ImageEnVect1.IO.SaveToFile('file.tif');
ImageEnVect1.SaveObjectsToTIFF('file.tif');

to load:

ImageEnVect1.IO.LoadFromFile('file.tif');
ImageEnVect1.LoadObjectsFromTIFF('file.tif');

4)
If you want save objects inside a jpeg or other formats which do not support Imaing Annotations, or you just want to merge image and objects:

ImageEnVect1.CopyObjectsToBack;
ImageEnVect1.IO.SaveToFile('file.jpg');

 

How do I store/retrieve multiple pages in a blob field using TImagenDBView?



TImageEnDBView cannot store/retrieve multiple pages in a blob. However there is a solution.
You should put a TImageEnMView component on the form and use it to load/save multiple pages as TIFFs in blobs using streams.
To store the content of TImageEnMView inside a blob write:

var tempStream:TMemoryStream;

tempStream:=TMemoryStream.Create;
ImageEnMView1.MIO.SaveToStreamTIFF( tempStream );
BlobField.LoadFromStream( tempStream );
tempStream.free;

To retrieve from a blob:

tempStream:=TMemoryStream.Create;
BlobField.SaveToStream( tempStream );
tempStream.Position:=0;
ImageEnMView1.MIO.LoadFromStreamTIFF( tempStream );
tempStream.free;

If you use a TDataSet inherited data set you can create a blob stream without using intermediate TMemoryStream: this will speedup operations. Example:

BlobStream:= myDataSet.CreateBlobStream(field, bmWrite);
ImageEnMView1.MIO.SaveToStreamTIFF( BlobStream );
BlobStream.Free;

..and..

BlobStream:= myDataSet.CreateBlobStream(field,bmRead);
ImageEnMView1.MiO.LoadFromStreamTIFF( BlobStream );
BlobStream.Free;


Finally, when save you can set compression info. For example, for black/white images you could write:

ImageEnMView1.MIO.Params[0].TIFF_Compression:= ioTIFF_G4FAX;
ImageEnMView1.MIO. DuplicateCompressionInfo;
..just before save.


 

How to set TOpenImageEnDialog to activate with Thumbnails visible?



(Windows 2000 or WindowsXP ONLY!)

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtDlgs, ieopensavedlg, StdCtrls, imageenproc, imageenio,
  ieview, imageenview, ExtCtrls, ComCtrls, XPMan;

type
  TForm1 = class(TForm)
    ImageEnView1: TImageEnView;
    ImageEnIO1: TImageEnIO;
    ImageEnProc1: TImageEnProc;
    Button1: TButton;
    OpenImageEnDialog1: TOpenImageEnDialog;
    SaveImageEnDialog1: TSaveImageEnDialog;
    ProgressBar1: TProgressBar;
    StatusBar1: TStatusBar;
    procedure Button1Click(Sender: TObject);
    procedure OpenImageEnDialog1Show(Sender: TObject);
    procedure ImageEnView1Progress(Sender: TObject; per: Integer);
    procedure FormActivate(Sender: TObject);
  private
    procedure WMUser(var msg: TMessage);message WM_USER;
  public
  end;

var
  Form1: TForm1;

implementation

uses GifLZW,TIFLZW;

// WindowsXP view constant values
const
  FCIDM_SHVIEW_LARGEICON = 28713;
  FCIDM_SHVIEW_SMALLICON = 28714;
  FCIDM_SHVIEW_LIST = 28715;
  FCIDM_SHVIEW_REPORT = 28716;
  FCIDM_SHVIEW_THUMBNAIL = 28717; // XP only
  FCIDM_SHVIEW_TILE = 28718; // XP

// WMUser
procedure TForm1.WMUser(var msg: TMessage);
var
 Dlg: HWND;
 Ctrl: HWND;
begin
  Dlg := msg.WParam;
  Ctrl := FindWindowEx(Dlg, 0, PChar('SHELLDLL_DefView'), nil);
  if Ctrl <> 0 then
  begin
    SendMessage(Ctrl, WM_COMMAND, FCIDM_SHVIEW_THUMBNAIL, 0 )
  end;
end;

// FormActivate
procedure TForm1.FormActivate(Sender: TObject);
begin
  DefGIF_LZWDECOMPFUNC:=GIFLZWDecompress;
  DefGIF_LZWCOMPFUNC:=GIFLZWCompress;
  DefTIFF_LZWDECOMPFUNC:=TIFFLZWDecompress;
  DefTIFF_LZWCOMPFUNC:=TIFFLZWCompress;
end;

// OpenImageEnDialog1Show
procedure TForm1.OpenImageEnDialog1Show(Sender: TObject);
var
  Dlg: HWND;
begin
  Dlg := GetParent((Sender as TOpenImageEnDialog).Handle);
  PostMessage(Handle, WM_USER, Dlg, 0);
end;

// OpenImageEn
procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenImageEnDialog1.Execute then
  begin
    ProgressBar1.Visible := True;
    ImageEnView1.IO.LoadFromFile(OpenImageEnDialog1.FileName);
    ProgressBar1.Position := 0;
    ProgressBar1.Visible := False;
    Caption := 'Browse Open For Windows XP- ' + ExtractFilename(OpenImageEnDialog1.FileName);
    Statusbar1.Panels[0].Text := ExtractFilePath(OpenImageEnDialog1.FileName);
    Statusbar1.Panels[1].Text := ExtractFilename(OpenImageEnDialog1.FileName);
  end;
end;

// ImageEnView1Progress
procedure TForm1.ImageEnView1Progress(Sender: TObject; per: Integer);
begin
  ProgressBar1.Position := per;
end;

// Close
procedure TForm1.Button4Click(Sender: TObject);
begin
  Close;
end;

end.





 

How to load embedded jpeg-RAW images?



Unfortunately Camera RAW formats aren't documented. Anyway it is possible to load embedded jpegs from NEF, CR2 and DNG raw formats. Examples:

DNG:
ImageEnView1.IO.Params.TIFF_SubIndex:=1;
ImageEnView1.IO.LoadFromFileTIFF('input.dng');

CR2:
ImageEnView1.IO.Params.ImageIndex:=0;
ImageEnView1.IO.LoadFromFileTIFF('input.cr2');

NEF:
ImageEnView1.IO.Params.ImageIndex:=1;
ImageEnView1.IO.LoadFromFileTIFF('input.nef');

CRW:
ImageEnView1.IO.LoadJpegFromFileCRW('input.crw');


 

How terminate a polyline without doubleclick?



Just set:

ImageEnVect.PolylineEndingMode:=ieemMouseUp;



 

I am unable to read recent Camera RAW files. Why?



In order to read recent Camera RAW files you should use the external dcraw plugin. For more details look at this page:

/ndownloads_plgins.asp
 



 

 

© 2002/2008 HiComponents. All rights reserved