Batch Export to Image File, e.g. JPEG or PNG

335 views
Skip to first unread message

Ad

unread,
Sep 9, 2008, 6:47:45 AM9/9/08
to MapInfo-L
Hi,

I was wondering if any one knows of a simple way to batch export
MapInfo Layout Workspaces to an Image file?

I have many Workspaces that I need to export to a PNG image file. Is
there some clever way, routine, or tool that will allow perhaps a text
file to be read in that opens each workspace in turn and exports to an
Image?

I am trying to avoid the tedious process of opening each one and
pressing Save As etc.

Any advice and guidance on this matter would be gratefully received.


Many Thanks.


Ad
:)

Nileshmish

unread,
Sep 9, 2008, 10:10:25 AM9/9/08
to MapInfo-L
Just create a layout of your workspace with desired zoom level.then go
to "File>>Save window as" or you can attain a keboard shortcut "Alt+f
+i" and save your layout map in your desired file extn. (bmp,jpg,tiff
etc.) . Moreover, you can also choose your output map page with
"File>>Page setup" option.
Hope it will work for you.
Cheers...

Martin A Spiers

unread,
Sep 9, 2008, 10:23:58 AM9/9/08
to mapi...@googlegroups.com

This thread may be relevant

http://groups.google.com/group/mapinfo-l/browse_thread/thread/cb5922b11005875e

Yours,

Martin Spiers
Senior Engineer
MWH
Kenburgh House,
Manor Row,
Bradford
BD1 4QU
Tel: 01274 718768
Fax: 01274 718799
email:  martin....@mwhglobal.com



Ad <bry...@halcrow.com>
Sent by: mapi...@googlegroups.com

09/09/2008 11:47

Please respond to
mapi...@googlegroups.com

To
MapInfo-L <mapi...@googlegroups.com>
cc
Subject
[MI-L] Batch Export to Image File, e.g. JPEG or PNG





"Disclaimer: This electronic communication and its attachments may contain confidential, proprietary and/or legally

privileged information which are for the sole use of the intended recipient. If you are not the intended recipient, any use,

distribution, or reproduction of this communication is strictly prohibited and may be unlawful; please contact the sender

and delete this communication. MWH does not warrant or make any representation regarding this transmission whatsoever nor

does it warrant that it is free from viruses or defects, correct or reliable. MWH is not liable for any loss or damage that

occurs as a result of this communication entering your computer network. The views expressed in this message are not

necessarily those of MWH. This communication cannot form a binding agreement unless that is the express intent of the

parties and they are authorized to make such an agreement. MWH reserves all intellectual property rights contained in this

transmission. MWH reserves the right to monitor any electronic communication sent or received by its employees.

This communication may come from a variety of legal entities within or associated with the MWH group. For a full list of

details for these entities please see our website at www.mwhglobal.com. Where business communications relate to the MWH UK

Limited entity, the registered office is Terriers House, 201 Amersham Rd, High Wycombe, HP13 5AJ Tel: 01494 526240 and the

company is registered in England as registration number 01188070. Where business communications relate to the MWH

Constructors Limited entity, the registered office is as above and the company is registered in England as registration number 04635724"

Ad

unread,
Sep 9, 2008, 12:24:55 PM9/9/08
to MapInfo-L
Hi Martin,

I will check out that previous posting.


* To Nileshmish, thanks for your posting but the key here is
"BATCH", I think what you have recommended is to do each one manually
one at a time. I am trying to do this in an automated way.

Cheers

Ad


On Sep 9, 3:23 pm, "Martin A Spiers"
<Martin.A.Spi...@uk.mwhglobal.com> wrote:
> This thread may be relevant
>
> http://groups.google.com/group/mapinfo-l/browse_thread/thread/cb5922b...
>
> Yours,
>
> Martin Spiers
> Senior Engineer
> MWH
> Kenburgh House,
> Manor Row,
> Bradford
> BD1 4QU
> Tel: 01274 718768
> Fax: 01274 718799
> email:  martin.a.spi...@mwhglobal.com
>
> Ad <brya...@halcrow.com>
> details for these entities please see our website atwww.mwhglobal.com.  Where business communications relate to the MWH UK

Ad

unread,
Sep 9, 2008, 12:30:28 PM9/9/08
to MapInfo-L
Hi,

Help is still required if at all possible, so far my initial posting
still stands.

Thanks :)
> > Constructors Limited entity, the registered office is as above and the company is registered in England as registration number 04635724"- Hide quoted text -
>
> - Show quoted text -

hendrik

unread,
Sep 10, 2008, 3:05:16 AM9/10/08
to MapInfo-L
Hi,

i wrote a mbx for a similar work.
Please specify your needs and i will see if i can customize the
program for your needs.

Hendrik
> > - Show quoted text -- Hide quoted text -

Tor Libram

unread,
Sep 10, 2008, 4:31:46 AM9/10/08
to MapInfo-L
Ad,

Try the following Mapbasic code. It takes a text file containing a
list of workspace names, opens each one, finds the first layout window
in the workspace, saves it to a jpeg in a folder called Exports,
closes the workspace and proceeds to the next on the list.
You will need to fiddle with the Save Window statements to get your
preferred output format, dimensions and resolution. Also, you will
need to create the text file containing the list of workspaces (Hint:
dir /b /s [path]\*.wor > [path]\list.txt)


Dim iLp, iWMkd, i2, iWin as Integer
Dim sWorksList, sWorks(1), sImg, sWPath, sWNewD as String

sWorksList = FileOpenDlg("","","txt","Select text list of workspaces")
sWPath = pathtodirectory$(sWorksList)
sWNewD = sWPath + "Exports\"
iWMkd = CreateDirectory(sWNewD,0)

Open file sWorksList for input as #1
i = 0
Do While Not EOF(1)
i = i + 1
Redim sWorks(i)
Line Input #1, sWorks(i) '*** Loop stores workspace file
names in string array
Loop
iLp = Ubound(sWorks) - 1
Redim sWorks(iLp)

Statusbar Message Progress()
For i = 1 to iLp
iWin = 0
Run Application sWorks(i)
sImg = PathToDirectory$(sWorks(i)) + "Exports\" + left$
(PathToFileName$(sWorks(i)), len(PathToFileName$(sWorks(i))) - 4) +
".jpg"

For i2 = 1 to NumWindows()
If WindowInfo(i2, WIN_INFO_TYPE) = 3 Then '***
Checks for Layout Window
iWin = WindowID(i2)
Exit For
End If
Next

If iWin > 0 Then
If WindowInfo(iWin, WIN_INFO_PRINTER_ORIENT) = 1 Then '***
Portrait
Save Window iWin As sImg Type "Jpeg" Width 45 Units "cm" Height
63.63 Units "cm" Resolution 150
ElseIf WindowInfo(iWin, WIN_INFO_PRINTER_ORIENT) = 2 Then '***
Landscape
Save Window iWin As sImg Type "Jpeg" Width 64 Units "cm" Height
45.23 Units "cm" Resolution 150
End if
Else
End If

Close All
Next


Have fun with it!

Dave

Ad

unread,
Sep 10, 2008, 11:34:53 AM9/10/08
to MapInfo-L
Hi,

Just wish to say a huge thankyou to Dave who has helped me enormously
with this matter. Thankyou so much for your time and solution :).

Cheers for the other guys who also got in touch to help, Hendrik,
Martin and
Nileshmish.

Kind Regards,

Ad
> > :)- Hide quoted text -

daveking66

unread,
May 3, 2017, 11:45:07 AM5/3/17
to MapInfo-L
Hi Dave,

Is this something that's still in use?

I was wondering how easy it would be to amend the script so it could be used to export the layout windows for a bunch of workspaces stored in a single folder?  It sounds like each workspace needs to be individually referenced in the solution below.

thanks,

Dave

keith drew

unread,
May 4, 2017, 9:50:46 AM5/4/17
to mapi...@googlegroups.com
Dave,

You may have found this thread too in your searches https://groups.google.com/forum/#!msg/mapinfo-l/AZsuwi24lWI/5m0aR-HRapcJ.

I've attached the tool mentioned as I don't think the link to the .mbx is active anymore and sounds like what you are after. 

Once loaded its a simple set up, you point to the folder of workspaces (create list of workspaces) then batch export that list (pointing to the generated list and then setting the paper size and resolution) and then it produces all the maps.

Cheers
Keith

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Batch layout export.MBX

David King

unread,
May 5, 2017, 10:12:36 AM5/5/17
to mapi...@googlegroups.com
Hi Keith,

I'd not seen that one before.  Thanks for forwarding it on, sounds promising.

thanks,

Dave
Reply all
Reply to author
Forward
0 new messages