Home › Forums › TWAIN Classic › Saving image as the file format and TIF with delphi twain? › Reply To: Saving image as the file format and TIF with delphi twain?
Here is link to use Delphi’s TJpegImage component. Here is what I did:
http://articles.techrepublic.com.com/5100-10878_11-5031886.html
jImage: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 panel
bImage.Assign(jImage);
// and display in TImage
Image1.Picture.Assign(bImage);
end;