While working with Visio, I ran into problems when modifying original “donor” shapes that I had.
The way it normally works is that you ungroup the source shape in Visio until there are no groups left and make required modifications in Visio.
You could stop here and save the results as a Visio shape. The problem with this approach is that while the original image had all the tiny elements in the picture collapsed as one single background image with single shape sheet, making it very fast to use, now the new ungrouped shape has dozens, if not hundreds of tiny elements or subshapes, like seen in the featured image (tiny objects framed with blue color). Each subshape is associated with their own Visio shape sheet. The more subshapes/shapesheets there are in a shape, the longer it takes to use the shape for the initial time, placing this mega shape from stencil to a drawing for the first time can take minutes or more, sometimes even crashing your Visio session. (After the initial placement, a copy of the shape is stored as a master shape in the drawing and additional copies are much faster to pull from the stencil.)
So in order to get rid of extra tiny elements and shape sheets and have more user friendly shape that won’t crash your Visio, you have to collapse or combine the subshapes back to single image to be used as a background image for the shape. In the past I’ve used a “hack” and saved modified image as single Scalable Vector Graphics (SVG) format image, did slight tuning in Inkscape software and finally pasted single image back to Visio.
Sometimes when you save a Visio shape in SVG format and open it in Inkscape, color information for some or all elements of the original shape are lost and shown in Inkscape as “unknown”. To fix it you have click each element to redefine color information for that element. If you have only handful of elements to fix, it isn’t such a huge deal.
Unfortunately this time the “donor” shapes contained few dozen, if not hundreds tiny elements and they all lost color information when saved as SVG. No way I was going to spend days or possibly weeks to fix all the elements manually.
For long time I’ve wondered how professional Visio developers make their shapes and collapse finished images as background images to save space and placement times. Once again I spent some time googling and trying to find an answer. Finally I ended up reading post titled “Copying a Visio graphic as a metafile can improve performance” by a professional Visio shape developer company called Visimation. In their post they describe how to use copy/paste special (Enhanced Metafile) to reduce the size of complex Visio shapes. No need to repeat their technique here, please read above post.
Funny thing is that I’ve known about Enhanced Metafile for a long time. If I remember correctly using Enhanced Metafile was part of NetApp Insight 2009? presentation which originally got me interested in Visio. I’ve described many times how to use Enhanced Metafile to copy content out of Visio. This makes me wonder how come I’ve never tried it to collapse subshapes. While looking for a solution I must have tried all the formats available in “Save as” dialogue and SVG provided the best results. It seems that with current version of Visio Enhanced Metafile is now a supported format to save images, maybe it wasn’t earlier or I just have missed it.
Sometimes the solution stares your straight in the eye, but you don’t see it. Once you see it, it is so obvious. Pheeeeeeeew, so much wasted time with SVG hack…
Using Enhanced Metafiles is way better method than my SVG/Incscape method to modify existing Visio shapes.
You can do all the work in Visio
- Much faster way, no need to go back and forth between Visio and Incscape to see if the results are acceptable
- No problems with color definitions vanishing
- Newly created image will retain 99% of the source image characteristics
- With SVG/Incscape combo it is more like 85%.
- Only few issues I’ve identified so far
- Fonts:
-
- If the original shape developer has used fonts that are less than 1 pt in size, those fonts will be reverted back to 1 pt in size when the source image is ungrouped.
-
- If there are only few strings or characters this is quite easy to fix: Copy the text and paste it back as Enhanced Metafile. The text is now an image instead of font and you can resize it to appear as smaller than 1pt font. The downside this solution is that it is now image, not text that is much easier to manipulate and change.
- Update Feb 21, 2020: Possible solution: use different scale when ungrouping the original image, like 1:2 instead of 1:16. See post: Visio by DTPPB: Maintaining font size while ungrouping background images
- Alignment Box:
-
- When pasted back as Enhanced Metafile, the dimensions of the image increase slightly when compared to the original source image.
-
- This is because of the alignment box drawn around the pasted image. To me it looks like the image within the alignment box retains the dimensions of the original shape, but there is some slack around the image and over all size of the shape is slightly larger, for 1U / 2U shapes I ended up with roughly 8% to 10% higher/wider shapes.
-
- Not a huge problem for me
-
- By looking at the comment section of the post describing this technique it seems that Visimation has found a solution for this increased size issue, but they did not describe how to do it. Something to wonder for the coming years. I bet that it is fairly easy fix and I feel very dumb again once I figure it out 🙂
- Update Feb 20, 2020: I now I’ve found a possible solution for Alignment Box size issue: Visio By DPTPB: Reducing size of Alignment Box
2 thoughts on “Visio by DPTPB: Reducing size of complex Visio shapes V2”