Einzelnen Beitrag anzeigen

bernhard_LA

Registriert seit: 8. Jun 2009
Ort: Bayern
1.134 Beiträge
 
Delphi 11 Alexandria
 
#5

AW: DNG- und Tiff-Bilder in Bitmaps umwandeln

  Alt 3. Nov 2011, 13:12
ich habe ähnlich Funktion wie oben um *.jpg, png, emf, ... in eine TBitMap zuladen, als Ergänzung das Laden *.tif ....


unit Unit_TTifImage;
/// ************************************************** ************************
///
/// TTifImage, pretty similar to pngimage, jpgimage ....
///
///
///
/// ************************************************** ************************

interface
uses Windows, { Windows API Funktionen }
Graphics, { pf1bit, pf... }
types, { Rect }
Classes,
ExtCtrls,
Dialogs;


type TTifImage = Class(TBitMap)

procedure LoadFromFile (const Filename: String); override;

procedure SaveToFile (const Filename: String); override;

end;



implementation

{ TTifImage }

///
/// see eg. http://www.delphipraxis.net/.....
///
procedure TTifImage.LoadFromFile(const Filename: String);
var aImage : TImage;
begin

try
aImage :=TImage.Create(nil);

aImage.Picture.LoadFromFile(Filename);

self.Width := aImage.Picture.Width;

self.Height := aImage.Picture.Height;

self.Canvas.Draw(0, 0, aImage.Picture.Graphic);
finally
aImage.Free;
end;

end;

///
/// not yet tested ...
///
procedure TTifImage.SaveToFile(const Filename: String);
var aImage : TImage;
begin
try
aImage :=TImage.Create(nil);

aImage.Picture.Bitmap.Assign(self);

aImage.Picture.SaveToFile(Filename);
finally
aImage.Free;
end;
end;

end.
  Mit Zitat antworten Zitat