Create gif file from mappoint

giaarcix
05-03-2006, 06:06 AM
Hello everybody,
I'm using visual basic to create a gif file from an object location in mappoint.
I successfully created my gif file by creating a temporary web page and then saving the related gif file.
My problem is that this operation takes a lot of time. I would like to know if there is a way to create directly the gif file without creating the webpage. Thank you very much for any help!
This is my source code:

Private Sub create_gif(latitute As Double, longitude As Double)

'INITIALIZATION OF MAPPOINT CONTROL
Dim oMap As MapPointctl.Map
Dim oWebPage As MapPointctl.SavedWebPage
Dim objLoc As MapPointctl.Location
MappointControl1.NewMap geoMapEurope

'I CREATE A TEMPORARY WEB PAGE (THIS CREATES ALSO THE GIF FILE)
Set oMap = MappointControl1.ActiveMap
Set objLoc = oMap.GetLocation(latitute, longitude, 100)
Set oWebPage = oMap.SavedWebPages.Add(filename:="c:\temp.htm", Location:=objLoc)
oWebPage.Save

'I SAVE THE GIF FILE SOMEWHERE IN MY COMPUTER
FileCopy "c:\temp_files\image_map.gif", "c:\test.gif"

'I DELETE THE TEMPORARY WEBPAGE
Dim fso As FileSystemObject
Set fso = New FileSystemObject
fso.DeleteFolder "c:\temp_files", True
Kill ("c:\temp.htm")

End Sub

Wilfried
05-04-2006, 02:33 PM
Hi,

Use CopyMap method. this copies the map to Clipboard. Then you have control yourself on what to do with it as fast as possible.

giaarcix
05-05-2006, 04:39 AM
Hello! Thank you very much: it worked fine and it takes much less time.
This is the code I used:

objLoc.GoTo
Clipboard.Clear
oMap.CopyMap
SavePicture Clipboard.GetData(), "c:\temp.gif"

The problem now is this: with the first (html) method I created a gif file with format 460x460 pixels that was about 30 or 40 kbytes.
With the second method (clipboard) the same gif becomes about 600 kbytes!
Is there a way to tell mappoint to save to the clipboard in low resolution (or something like this)?
If the only way is creating another function that lowers the resolution of my file I suppose it would take the same or more time than creating the gif through the html page...
Any help will be appreciated!
Thank you again,
Giacomo

giaarcix
05-05-2006, 05:49 AM
Ok, I have understood another thing: the method I used (SavePicture Clipboard.GetData(), "c:\temp.gif") always saves the mappoint image as a BMP file and not a GIF.
So I think the right question should be: is there a way to make VB save my image in other format than BMP?
Thank you again,
Giacomo

Wilfried
05-06-2006, 01:04 PM
Hi,

Yes you are right. Copy to clipboard is a bitmap image of the data. The formats you describe like bmp, gif, jpg, etc are file formats. They have eventually compressed methods with or without data loss.

So indeed it is VB that has to have a function to save a bitmap to a gif or any other file format. But you loosing me :( My native language is object pascal, C#, Flemish and a little English, so I cannot help. But sure others will drop in here !

allocater
12-07-2007, 11:48 AM
i tried this code in VBA, but VBA does not know "Clipboard", so how do I do this in VBA?

Wilfried
12-08-2007, 10:46 AM
Hi,

Then you have to call the windows API functions. This is possible in any language, but I have no idea how to do this in VBA. Hope someone else will drop in here.

 
Web mp2kmag.com
mapforums.com