Reducing Mod SIZE: remove old images

I am creating a new MOD by changing and adding to an existing MOD.
I can see that the OLD images are still there for me to use but I would like to delete them to shrink the MOD size.

Is there a way to remove old images short of starting over from scratch?[/b]

I’d add the same question for old scenario setups that are not used.

You can remove old images by doing this:

  1. Rename your existing mod modulename_old.vmod, where “modulename” is the actual name.

  2. Unzip modulename_old using your zip utility of choice into a new folder. Let’s call this the Unzip folder; typically it will now be named modulename_old. You’ll have a folder named Images and some other files (such as BuildFile and some others).

  3. In the Images folder, delete the images you don’t need anymore.

  4. This is the tricky part: At the level of the BuildFile, re-zip the module files. Select the BuildFile, Images folder and everything else in the Unzip folder and zip them. When you are done, you will have a zip file inside the Unzip folder at the same level as the BuildFile that consists of all the files you want to include in the new module. (What you don’t want to do is select the entire Unzip folder from outside the folder and just zip it. This will produce an invalid module.)

  5. Rename the new zip file modulename.vmod (remove the zip suffix), then move the module its original location. You can now delete the Unzip folder.

How do I determine the ‘level of the build file’?

On Jan 24, 2010, at 4:26 AM, callicp wrote:

Right now the only way to remove old, unused images is to manually
edit the build file.

There is a Feature Request in to provide a more convenient way to do
this, but it turns out that determining which images are not used in
a module is harder than one might imagine.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

It would be useful if all non system images were removed. I can always add back what I want.

The same method works for scenario files; just delete the .sav or .vsav files you don’t want instead of the images.

By ‘level of the build file’, that is to say, if you have two folders on your desktop, A & B, they are both at the same ‘level.’ Files inside folder B are one ‘level down’ from folder A. Folder A is one level ‘up’ from the files inside folder B.

If your unzip folder is on your desktop, and you zip that folder, you will get a new zip file with the unzip folder inside it and all your files inside that folder.

But when Vassal goes to open your new zip file, you will get the message ‘Invalid Vassal Module’ because Vassal expects the BuildFile, Images folder and other files at the root level–instead, what it finds is the folder you had all those files in, and it gets confused. It’s like unwrapping a wrapped Christmas present to find yet another wrapped box inside.

So, after deleting your unwanted files, when you re-zip the files (BuildFile, Images folder, Saved Games folder, etc), what you should do is open the unzip folder (that is, be at the same ‘level’ as the actual BuildFile), select all the files in it,and zip those. Try it out and see how it works.

Let’s not confuse people. I think you mean to manually edit the module file, not the ‘build file’?

What I would like to see is a ‘File Explorer’ available from the Module Editor that displays the contents of the module and allows you to dive into sub directories, highlight and preview images, select and delete files. The files would be marked for deletion and not written to the archive the next time the module is saved.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

OK I got the BUILD FILE LEVEL.

I ziped everything into temp1.zip because thats what was there before.
But do i zip it again at the Higher folder level?

I’ll try.

OK I figured it out.

  1. Convert your mod [MOD1.vmod] to a ZIP file. [MOD1.zip]
  2. Unzip MOD1.zip
  3. You now have a folder named MOD1
  4. Inside you have an Images Folder and others. You can delete any images you find here if you like.
  5. Remove any images you like. If you remove a necessary image you can replace it in the vassal editor. [be sure you have your images backed up]
  6. Create a zip file from all the files and folders from the DIR that contains; __MACOSX, HELP, IMAGES, buildFile and moduledata. I did CRTL-A, right clicked and told it add to ZIP.
  7. you will get a chance to name the Zip file in the Zip program. Change it to MOD1.ZIP
  8. change MOD1.ZIP to MOD1.vmod

You can now open MOD1.vmod with Vassal and edit it. My file shrunk from 8MB to less than 1 MB. I got some errors because Vassal could not find some images. But these can be added as you would add a new image.

Thus spake “callicp”:

It’s not necessary to add __MACOSX back into the module. That was put there
by Mac OS X, not VASSAL.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thanks for that. I wish I had more time to experiment.

On Jan 24, 2010, at 12:56 PM, Brent Easton wrote:

Correct. I was answering too quickly. It is the module file that
gets manually edited.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Has somebody done this recently?

I followed the instructions here to remove unused image files, but when trying to open the module again, a window comes up saying that there has been a bug. I’ve tried to unzip/zip the renamed .vmod with Winrar and Winzip, even deleting the files without unzipping but I get the same error all the time.

I seem to recall that I’ve done this before for another module and it worked then. May it be a problem related to the Vassal version?

If I am correct the method has become much easier since two years ago. I’ve recently deleted just a few old images from my module without problem, and this is how I’ve done it:

Make a copy of the module, just to be safe.

Change the module filetype to .zip, and ONLY .zip (as far as I know). I tried .rar and got errors attempting to edit it.

Open the new .zip module with your favorite program, and then simply delete the unused images in the images folder, no build file meddling needed.

Then change the filetype back to a .vmod, and your good to go.

Again I have done this with just a few images and everything turned out fine, I do not know what the consequences are of deleting images which are in fact used, so be careful.

Actually right here is official documentation on the subject, not much but you may find this page useful: vassalengine.org/wiki/Creati … _module.3F

Thus spake Hannahgawa:

Has somebody done this recently?

I followed the instructions here to remove unused image files, but when
trying to open the module again, a window comes up saying that there has
been a bug. I’ve tried to unzip/zip the renamed .vmod with Winrar and
Winzip, even deleting the files without unzipping but I get the same
error all the time.

I seem to recall that I’ve done this before for another module and it
worked then. May it be a problem related to the Vassal version?

I expect that you’re not correctly rezipping the module. It’s unlikely
that the problem has to do with the version of VASSAL you’re using.
What is the error message?


J.

Thank you, reddeblu!

I tried to do that, to delete files without unzipping them, but this time using Winzip, and it worked! Now the module size is 40% lower :smiley: