Unfortunately, I have never used SetProperty but you might try setting the EXIF data directly and add EXIF_HasEXIFData:= True:
var
iIEBitmap: TIEBitmap;
iImageEnIO: TImageEnIO;
iImgStream: TMemoryStream;
iOutStream: TMemoryStream;
begin
iIEBitmap := TIEBitmap.Create;
try
iImageEnIO := TImageEnIO.Create(Self);
try
iImgStream := TMemoryStream.Create;
try
iOutStream := TMemoryStream.Create;
try
iImageEnIO.AttachedIEBitmap := iIEBitmap;
if (FileExists(FFileName)) then
begin
iImageEnIO.LoadFromFileAuto(FFileName);
iImageEnIO.Params.EXIF_XPTitle := 'Photograph of Dolly';
iImageEnIO.Params.EXIF_XPSubject := 'Dolly';
// This is important if you want change some EXIF fields
iImageEnIO.Params.EXIF_HasEXIFData := True;
iImageEnIO.AttachedIEBitmap.Resize(300, 300);
iImageEnIO.InjectJpegEXIF(iImgStream, iOutStream);
iImageEnIO.SaveToStream(iOutStream, ioJPEG);
iImgStream.Position := 0;
// ...
Response.ContentStream := iImgStream;
end;
finally
iOutStream.Free;
end;
finally
iImgStream.Free;
end;
finally
iImageEnIO.Free;
end;
finally
iIEBitmap.Free;
end;
end;
This code has not been tested.
InjectJpegEXIFStream replaces EXIF information of the InputStream stream (jpeg) with EXIF current in memory without loading or modifying the original image. OutputStream contains the modified stream. The method returns false if it fails.
William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html