Hello!
How do i export the currently viewed map picture to a JPG file?
Best regards, Magnus
Hello!
How do i export the currently viewed map picture to a JPG file?
Best regards, Magnus
Hi,
You can use the CaptureScreenShot method and then capture the result in the OnCaptureScreenShot event
Ok thanks.
I found the TTMSFNCMaps.CaptureScreenShot procedure but there is no TTMSFNCMaps.OnCaptureScreenShot ?
Best regards, Magnus
Are you using the latest version? I not, we'll release an update tomorrow which should have this event available.
Ok, thanks. The new version has a OnCaptureScreenShot event and it fires after a call to CaptureScreenShot.
Now the problem is to convert the TTMSFNCBitmap to a jpg picture.
Procedure TMapViewForm.MapCaptureScreenshot(Sender: TObject; AScreenShot: TTMSFNCBitmap);
Var CapturedJpegImage: tJpegImage;
Begin
CapturedJpegImage := tJpegImage.Create;
CapturedJpegImage.Assign(AScreenShot);
End;
The assign statement results in error 'Cannot assign a TTMSFNCBitmap to a TJPEGImage'
Please help
Can you try saving it to a stream first and then load it in a TJPEGImage?
procedure TMapViewForm.MapCaptureScreenshot(Sender: TObject; AScreenShot: TTMSFNCBitmap);
var
CapturedJpegImage: tJpegImage;
begin
CapturedJpegImage := tJpegImage.Create;
ms := TMemoryStream.Create;
AScreenShot.SaveToStream(ms);
ms.Position := 0;
CapturedJpegImage.LoadFromStream(ms);
ms.Free;
end;
Hello!
No luck :-( I get an Exception "JPEG error #53" in the CapturedJpegImage.LoadFromStream(ms);
Best regards
hi,
the returned format is actually PNG, so you need to use TPNGImage instead