Home › Forums › TWAIN Classic › Saving image as the file format and TIF with delphi twain?
- This topic has 2 replies, 3 voices, and was last updated 15 years, 1 month ago by Benedictum.
- AuthorPosts
I am using a component DelphiTwain for acquisition of the image scanner, but can only save as BMP.
I would save the images in TIFF and JPG.
If someone knows what to do I appreciate in show ….!How do you feel about using a different component for image manipulation?
I won’t pretend to know Delphi, but there must be a ton of general purpose libs available for converting bmp to xyx. If I was certain that ImageMagik has a Delphi port I would recommend it, otherwise I would look outside of the twain spec for a general purpose image manipulation library..
Here is link to use Delphi’s TJpegImage component. Here is what I did:
http://articles.techrepublic.com.com/5100-10878_11-5031886.htmljImage:TJpegImage; // declared in the unit header
procedure TMainForm.TwainTwainAcquire(Sender: TObject; const Index: Integer;
Image: TBitmap; var Cancel: Boolean);
var
mStream: TMemoryStream;
bImage: TBitMap;
begin
// Convert Image to jpeg
mStream := TMemoryStream.Create;
bImage := TBitmap.Create;
jImage.Empty;
jImage.compressionQuality := jComp; // compression – ignore if not needed// assign and convert to grayscale
jImage.assign(Image); // image is the bitmap acquired
jImage.Compress; //
jImage.Grayscale := true; // I do not need the color –
// convert back to bmp so that
// I can display on the TImage panelbImage.Assign(jImage);
// and display in TImage
Image1.Picture.Assign(bImage);end;
- AuthorPosts