BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Screen shot of part of drawing

Started by Yacine, April 25, 2013, 06:13:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Hi everybody,
I'm looking for a possibility to export parts of a drawing as bitmap images and tought remembering, that when you save your drawing as a bitmap file, after having selected a shape, visio would create a bitmap with that same shape, but also all the shapes within the boundaries of the selected shape.
I must have dreamt it, because I cannot replicate that behaviour (Visio 2007) - only the selected shape itself is shown in the bitmaps.
Do I really need to save the whole drawing and crop it programatically afterwards?

Paul Herber

Hi Yacine, if a shape (or shapes) are selected then only that (those) shapes will be saved into the image.
If you create a selection area with the mouse then all shapes within the area will be saved. Whether or not shapes partially in the area are saved depends on the options setting "Select shapes partially within area".

Electronic and Electrical engineering, business and software stencils for Visio -


Hi Paul, You're right, but it doesn't cut the connectors at the box boundary. So you either select only the shapes, that are completely within the box and won't get the connectors leaving the box at all, or you include the connectors crossing the boundaries and get a "hairy" box. ;-).

PS: This applies also for the shapes shown in the example, which are only partially in the box.

Paul Herber

For screenshots like this I just capture the whole screen (using PtrScn) and crop in an editor (I use PaintShop Pro) or do a capture directly in PaintShop Pro).
I don't think Visio can do so directly.
Electronic and Electrical engineering, business and software stencils for Visio -


If Visio can do so, we can save much time.
Time is money. :)
Best Regards,

Junichi Yoda


I thougth I read an article (from VisioGuy?) with sth. like a magnification lens or some such. But I can't find it with the search, maybe I just dreamed about it. But if that article realy exists it would have faced a similiar problem.


If your using Win 7 or later, you could always use the windows Snipping Tool.

Alternatively, you could implement your own screen capture using VB. If you need to change grid, layer visibility etc then this is the way I would go.
Live life with an open mind


Thank you, AndyW.

I forgot Snipping Tool.
It is useful to me.
It may be useful too to Yacine, isn't it?
Best Regards,

Junichi Yoda


Thank you for the participation all.
But no, the snipping tool does not help. I use it too, but here I need a tool that can make dynamically snapshots based on coordinates stored in a database.
We are talking about 100 (?) snapshots. And I want to be able to update them automatically, when needed.

I will try the following: export the whole page, open the so saved image, then knowing the coordinates of my rectangle compare the pixel width and height to the actual visio coordinates of both the page and the rectangle, then crop the bitmap accordingly.

I will let you know, when I have worked it out.
Cheers, Yacine.



Assume the background is what you want....why not just some screen scrap...I have used MWsnap for 10 years quite nicely for this


Alright, I got it.
Actually it was just a matter of putting together code snippets available over the net.
Here is a setup, that allows you on double click on the red rectangle to save the shapes and images shown inside the rectangle as a PNG bitmap.
The connection to the database is not implemented here, but that should not be a big deal.
One restriction to this solution, is that all shapes need to be within the boundaries of the page, otherwise the formulas will not work properly. By means of more control and correction structures this problem could be overcome.
For now, this solution just provides the basics of what I described earlier as my problem.

As explanation for what I worked out:
Main deal was to understand how the "foreing image info" section works. That is a section that you will only see on imported pictures (??? not sure about the absolute trouth about this !!!)
Just keep im mind, that you can scale your image as you like, but need then to correct the values of ImgWitdth  and ImgHeight to their initial values as Visio will automatically scale them proportionally to the dimensions of the shape.
The offset values depend only on the left and the bottom values of the desired cropping.
There is no more to it.

What you got whit this, is the capability to remote control the screenshots of a drawing ... with automated naming, attached comments (in a DB), animated exploration of the drawing, etc.

Enjoy, Y.

P.S.: By the way, I did find him!


So they (M$) improved Visio again. Now when you insert a big bitmap into a drawing, Visio decreases automatically the resolution so much that it the picture gets useless. Blurry to a level of unreadable.

That is very pity because my snapshot tool based on being able to export the whole drawing as bitmap, re-import and crop it, then save again to get the desired extract of the drawing.

Googling the issue shows that M$ is informed and has no urge to solve the problem.

So I'm again into solving the problem of needing to make snapshots of big (very big) drawings to produce documentations.
The snapshots are meant to be inserted as images in an attachment field in an Access Database.

I don't know if any of you has a solution to this issue. Any hint is welcome.

I then thought about using a snapshot application (in my case Windows' Snipping) and insert the image via the clipboard.
But lost patience.

Web control with pan and zoom
Access offers an ActiveX web control that you can feed with an SVG that you would have exported from your Visio Drawing.
In your access form, you would then present the user this SVG, let him zoom and pan to desired section and only store these coordinates.
Fine and good, but when it comes to printing you'll probably need individual pictures again.


I Had My Patience Tested I'm Negative Png Lustiges Katzen Bild 1


Uh...just what is a "big" bit map image?   What kind of Visio size, scale factor, hardware settings like screen resolution, etc.

Love the cat!
Visio 2019 Pro


The image is a "little" big. 40378 x 4495 pixels / 350 dpi / 24 bit color depth / 12 MB.

And the good thing in getting up early, the inspiration muses are still flying. Caught one and got kissed.

I could as well zoom and pan the drawing itself.
I mean, I could change the page width and height to the dimensions of my screenshot shape and move its origin also to this shape.
Then do the export of this newly defined page, but this time only once, without re-import and cropping.

I'll let you know of the results

... 2 hours later.
Using a custom page is a bad idea, because the page sizes are defined by your printers. So you won't get arbitrary aspect ratios when printing.
Exporting all doesn't work neither because it exports also shapes outside the page limits.
This path is death.

New one. "Fragmenting"

You will recall that my issue was to get also the shapes that overlap partially the screenshot frame.
If I select all the shapes to be shown and the screenshot frame, I can then fragment everything, select the inner parts and export.
This works, specially with the undo functionality to revert the fragmented shapes to their original state.
Limitations: It works only with plain shapes. No images, no OLE stuff and the like.

Probably my last and best option - The snipping tool.

1. Make the screenshot. (Snipping will automatically paste the image in the clipboard)
2. Paste the image anywhere in the drawing
3. Switch to access and press a button that will do the following:
a. select the last shape on the drawing (activepage.shapes(activepage.shapes.count)). -- Thinking about it, I may rather select the image. This way I won't delete shapes inadvertently.
b. export to a fixed location and filename (eg activeproject.path & "img.png") and delete this last shape.
c. import the so created image file into the attachment file.

There's no big magic in this solution, but it is a simple and effective workflow.

Disadvantage: No automatic batch screenshots generation (eg generating them from coordinates)

I'm probably closing this topic for now, but you guys are of course welcome to add any crazy ideas.

Thanks so far and cheers,



... so much muses flying around ... need to close the office window. ;)
Google search "VBA crop png" throws the following link out.
And among the different transformation functions you get:

Sub imgCrop(inFile As String, outFile As String, left As Long, top As Long, right As Long, bottom As Long)
    Dim Img As Object, IP As Object
    Set IP = CreateObject("WIA.ImageProcess") 'create WIA objects
    Set Img = CreateObject("WIA.ImageFile")
    Img.LoadFile inFile 'load image
    IP.Filters.Add IP.FilterInfos("Crop").filterid 'setup filter
    With IP.Filters(1)
        .Properties("Left") = left
        .Properties("Top") = top
        .Properties("Right") = right
        .Properties("Bottom") = bottom
    End With
    Set Img = IP.Apply(Img) 'apply change
    Img.SaveFile outFile 'save image

End Sub

As I know the dimensions of my screenshot shape, it ought to be easy to determine the dimensions for the cropping.
This solution is way better than the previous one:

  • export the whole drawing only once
  • batch generation of screenshots from coordinates

Thinking it furthermore, I could also think of solutions without a connected Access DB.
One could put the screenshot shapes on a dedicated layer. Switch them on and off to ones needs.
These shapes could even have props holding a sort key for generating a file number and a title - eg "03_Detail so and so.png".
A macro would then iterate over all these shapes and generate the screenshots.
This workflow is in so far nice, as the set of images can be edited at any time.
A wise thought would be to create a timed folder, so you can manage the export versions.

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 435 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1322KB.
Tokens: post-login.
Cache hits: 14: 0.00156s for 26,767 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]