Wildly different image file sizes

Started by Jennifer, May 12, 2019, 02:35:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jennifer

In helping a friend design a bracelet, I created several drafts of the 6 gold segments with fill shading. When I saved the Visio file, I was surprised at the size. It was huge -- over 120 MB. In an attempt to figure out what was taking up so much space, I deleted all but 1 draft and saved that file. It was over 13 MB (13,471 KB). I then saved the draft image as a JPG file at 100% quality with dpi settings of 96x96, 360x360, and 600x600. The file sizes were 41 KB, 238 KB, & 479 KB, respectively -- tiny compared to the source Visio file.

I then created a new (empty) Visio file. I copied each of the saved JPGs into the Visio file and saved that. The sizes of the saved Visio file were between 96% and 99% smaller than the source Visio file.


[font=courier]
JPG      Visio    DPI    %
41 KB    145 KB    96   1.1
238 KB    308 KB   360   2.3
479 KB    496 KB   600   3.7
[/font]


I then pasted the original image from Visio into IrfanView and looked at the image properties. It said it was 745 x 97 pixels. If I set the dpi at 96x96, it said the print size would be 7.76 x 1.01. The actual size in Visio is 7.75 x 1.00. I then saved that image. The file size was 46 KB.

I then copied all 4 JPG files into Visio. The 2 smaller ones were slightly blurry, but I could not tell much difference between the 360 dpi and the 600 dpi versions. I printed that page on my medium quality inkjet printer. I couldn't tell much difference between any of the versions.

I then copied all 4 versions into a Word document. I could see a little difference between the lo-res and hi-res versions, but not much.

Here's my question: Why does Visio need over 13 MB to store a fairly simple drawing involving 6 ovals with a fairly standard fill pattern when files that are 95% smaller look about the same?

I tried to attach the files, but am limited to 2 files and was told that they exceed the 500 kb limit. So I attached one and uploaded them all to this Dropbox folder:

https://www.dropbox.com/sh/s39ksoycq3euchc/AAD5E9DtV0gN4-CHEam24Lz6a?dl=0
Using Visio 2019, part of Office 365 on Windows 10

Paul Herber

We'd need to see the original Visio file to see what is causing the huge file size.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Jennifer

Of course, sorry. I just added it to the Dropbox folder.
Using Visio 2019, part of Office 365 on Windows 10

Paul Herber

All the space is being used by the images of the diamond and (sapphire)?
Saving those two images as shapes into the Document Stencil, then replacing each image on the page with the shape you just created takes the size from 13.5MB down to 4.5MB. Each of the images on the page is just an instance of the master within the document stencil. You could create your own stencil with the two images if you want to.
Images do take up a lot of memory, as a file they can be compressed but have to be kept as uncompressed bitmaps within Visio.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Jennifer

Quote from: Paul Herber on May 12, 2019, 05:05:31 PM
All the space is being used by the images of the diamond and (sapphire)?
After I posted that, I wondered if they were the problem. They are so small, that I guess I didn't suspect them.

QuoteSaving those two images as shapes into the Document Stencil, then replacing each image on the page with the shape you just created takes the size from 13.5MB down to 4.5MB. Each of the images on the page is just an instance of the master within the document stencil.
Are you saying that each copy of a shape is just a pointer to the actual object and not a copy of it?

Can you post the general steps for doing that so I don't screw it up?

QuoteYou could create your own stencil with the two images if you want to.
That sounds like what I need to do. I assume a "stencil" is a collection of shapes, right?

Can I have a stencil just for that document that is only loaded when I open that document and that it is not  loaded for every other Visio document?

Can you post the general steps for doing that so I don't screw it up?

QuoteImages do take up a lot of memory, as a file they can be compressed but have to be kept as uncompressed bitmaps within Visio.
Is that true of vector graphics, too?

Thanks
Using Visio 2019, part of Office 365 on Windows 10

Jennifer

I just uploaded a second Visio doc to the Dropbox folder. I added each of the two bracelet segments to the Document stencil. I didn't know what that was before. They started out with names like Master.19, so I assumed they were the master shapes you mentioned.

I then deleted the shapes from the page and saved the file. The doc size was 4544 KB.

I then dragged each master shape to the mage and made 10 copies (20 total). When I saved that file, the size was only 4566 KB. Excellent!!!

I uploaded that file to the Dropbox folder as temp2. Let me know if I did everything right.

Thanks
Using Visio 2019, part of Office 365 on Windows 10

Jennifer

I just uploaded temp3.vsd. I wanted to see if changing the master shape would change all of its instances. So I right-clicked on the master shape and selected Edit master and then Edit master shape. I was given a new page with the shape. I moved the diamond image to the right about a quarter of an inch. When I closed it, it asked if I wanted to update the master and all of its instances. I clicked Yes. All 10 of the instances had changed. Excellent.

Then I wanted to change it back, so I used Undo (Crtl+z) a bunch of times until the master was back to the way it had been. But the instances did not change. The diamonds were still to the right of where they had been. Then I dragged another instance of the master shape to the page. It had the diamond in the right place back to the left.

I figured that the link to the master had been broken for the previous instances, so I saved the document. But it was still about the same size, so those shapes were instances of something.

Next, I edited the master again and added a text field. When I saved it, the text field appeared in all of the instances, both the old ones with the diamonds shifted to the right and the new one with the diamond in the correct place. I can't understand how the 10 old instances can be linked to the master and still have the diamond in the wrong place.

Can you check out temp3 and tell me what I did wrong?

Thanks
Using Visio 2019, part of Office 365 on Windows 10

Jennifer

I've done a little more testing. The master shape feature is going to save me a lot of space. I'm not particularly short on disk space, but some of these huge files take forever to load and save. I should have learned about this a long time ago. But I've basically taught myself Visio, originally to do flowcharts. Then when I needed to do some simple graphics work, I chose it because I already knew it a bit. I've just learned the features I needed with a minimal amount of study time.  :P

I just tried a little experiment and got some surprising results. First, I compared the size of 10 copies of the graphic image of the diamond with 10 instances of that same image as a master shape. The savings was almost 90%.


Size   Contents
     29   New (empty) document.
  4,506   Added gold oval, silver oval, diamond image, sapphire image.
44,626   Made 10 copies of each object.
  4,506   Deleted all but 1 of each.
  4,491   Moved all 4 to master shapes.
  4,516   Added 10 instances of each master shape to page (89.9% savings).


Next, I tried making a master shape from a group of instances to see what the savings might be there. The results were very disappointing unless I did something wrong.

Size   Contents
     29   New (empty) document.
  1,907   Added diamond image.
18,640   Made 10 copies of the image.
185,953   Made 10 copies of the 10-image group (100 total).
  1,907   Deleted all but 1 copy of the image.
  1,891   Moved it to a master shape.
  1,910   Made 10 instances on page.
  1,922   Made 10 copies of 10-image group (100 total).
  1,911   Deleted all but 10 instances.
20,487   Moved the group of 10 images to a master shape.
20,509   Created 1 instance of the group on the page.
20,527   Made 10 copies of that (100 total).


The 10 copies of the actual image shape made the document 185,953 KB. And 10 instances of the image master shape was only 1,922 KB. But when I made a master shape of a group of 10 instances, not images, the file size increased to 20,487. It looks like master shapes cannot include instances. They resolve them all to the underlying images.

Are these results correct? Is it not possible to make master shapes that contain instances of (links to) other master shapes? If so, this is a serious limitation.


Using Visio 2019, part of Office 365 on Windows 10

Paul Herber

When a shape is in stencil, then dragged from the stencil onto the drawing page, a copy of the master is placed in the Document Stencil and the shape on the page (called an instance) is just a pointer to the original master plus the details that make this instance unique e.g. X and Y coordinates. Any changes made to the instance on the page e.g. Width or Height are extra cells that get added to the instance. All other cells just refer back to the master. So using a master many times is a huge saving in memory and file size.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Jennifer

Quote from: Paul Herber on May 13, 2019, 09:27:03 AM
When a shape is in stencil, then dragged from the stencil onto the drawing page, a copy of the master is placed in the Document Stencil
I don't understand this. Would there then be two masters?

In my case, I put the shape in the Document Stencil originally.

Quoteand the shape on the page (called an instance) is just a pointer to the original master
Do you mean the original master not in the Document Stencil?

Quoteplus the details that make this instance unique e.g. X and Y coordinates. Any changes made to the instance on the page e.g. Width or Height are extra cells that get added to the instance.
And the instance remains an instance, not a copy of the master, right?

QuoteAll other cells just refer back to the master.
When you say cells, you are talking about properties of that shape, right? The instance gets its properties from the master unless changed in the instance, right?

QuoteSo using a master many times is a huge saving in memory and file size.
It sure it. Thanks for pointing this out to me.

But what about my other question about what happens when I make Master B containing instances of Master A? Those instances seem to get converted from instances to copies of the original shape with no space savings. I also posted this as a separate question in the Shapes section with more detail so it could get addressed specifically.
Using Visio 2019, part of Office 365 on Windows 10

Paul Herber

The master in the stencil is in a different document, stencils and drawings are different documents and cannot reference each other. When a shape is dragged from a stencil onto a drawing a copy of the master is made in the Document Stencil and the shape on the page references the master in the Document Stencil. The stencil may now be closed and the reference to the master will be retained in the Document Stencil.

If multiple instances of a master are on a page then they all refer back to the master in the Document Stencil. A huge saving of space.

The original shape doesn't have to have come from a stencil, the shape could have been created on the drawing page. This in itself does not create a master, but if that shape is then dragged into the Document Stencil then it will become a master.

QuoteWhen you say cells, you are talking about properties of that shape, right? The instance gets its properties from the master unless changed in the instance, right?
Correct.

I don't think there is any way to do masters within masters. It would certainly be useful to have various parts that could be updated individually.

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

https://www.paulherber.co.uk/