A guide to reduce your Custom Overlay file sizes. (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Useful Material



Message


brassem -> A guide to reduce your Custom Overlay file sizes. (10/6/2013 9:51:13 AM)

A guide to reduce your Custom Overlay file sizes for Command Modern Air/Naval Operations.


6th October 2013. Version 1.00
1st November 2013. Version 2.00 Revised after viewing Tomcat84's tutorial.
4th April 2018. Version 3.00 New graphics after Photobucket extortion.

Introduction.

The feature of adding custom overlays to missions in this game will prove to be a significant benefit to the both the player and mission creator. However the game scenarios can cover some very large areas, to cover these with overlays will result in very large file sizes in the Gigabyte range that will crash the game. I hope the technique in this guide will allow users to get their overlay file sizes down to manageable levels while working within the game limits. The user will still have to be prudent on how they want detail added by the custom overlay, at the cost of file size. In this example GMAP is used to create a user defined Custom Overlay.

The process described here in this guide is a simple graphics technique of reduce and expand, at the cost of image quality, applied to CMANO Custom Overlays. This is very much a work in progress as the game evolves. The ingame tutorial used as the basis for this guide is: Basic Training Air Operations, 1983.scen. In this guide we will add some more detailed images to the map terrain of this scenario. Tactical and Mission critical detail can also be added.

Requirements.

You will need to know how to change image file sizes in a graphics application. If you do not, then don’t continue.
If you are running a 32bit computer, expect longer times and even lockups as the system tries to juggle large data chunks. If you have low disk space, don’t continue.

A graphics program where you know how to scale a png image. In this example Photoshop CS4 64bit is used.
GMAP. http://greatmaps.codeplex.com/ Just for the fact that you can create reference images that can be used as a guide to building a custom facility.
Low level text editor. Do not use Word as it adds un-needed data to the file.
Calculator.
Patience and determination.

Procedure.

This tutorial is supplementary to the Custom Overlays 101 as provided by the Slitherine Group in their e-book manual. ( 8.3 Custom Overlays 101. Page 121 ). It is assumed that you have GMAP installed and working. The game state used in this tutorial is Command v1.01 Release Candidate 2 (Build 439).
The Custom Overlay feature works as described. If you add one image and then another, the last loaded will overlay the first. This is where alpha channels and transparency will play a role in the overall graphic effect, so low resolution overlays should be loaded first, while the more detailed high resolution image loaded after. The working steps will then be to work with the detailed images first, followed by general low resolution images later as space will allow. Work in, then out, to see what you are left with.

Tomcat84 has done a brilliant youtube tutorial on custom overlays where he briefly shows the technique as described here for image reduction in video. Near the end he shows a better technique that rids the file of transparency data, that can help even further with file reduction. This video is a must see for overlays! (I am curious to how both techniques zip down. As transparency dead space should compress well.)
Tutorial by Tomcat on Custom Overlays

Ok, Lets get some terrain details in on the Basic Training Air Operations, 1983.scen mission. The known enemy target will be used in this example.

Start the scenario so that the target is revealed and we can use the mouse-over to write down the Global Position coordinates of it.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic01.png[/image]

Pic01.

The general Global Position of the target is N39° 14’ 16”, W118° 14’ 33”. You need to convert this to a decimal coordinate to work with GMAP. You can use websites such as http://www.earthpoint.us/Convert.aspx to do the conversions, which yields 39.2377778° -118.2425000°. Once we have the decimal GP coordinates it will make further work easier.

Load up gmap and type those new GP coordinate values in. (Bing satellite view)
The red cross will be the location of the coordinates that you typed in. Zoom in to get a good overall picture on the screen of what you wanted to capture. Then drag out a box (plus Alt key) to the area you think would encompass the red targets. Start from the top left corner and drag down to the bottom right. The top left corner will be the actual reference coordinate used in the .pgw file. By how much you dragged across and down will be the scalars in the .pgw file.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic02.png[/image]

Pic02.

Click the [Get Static] button on the right panel. In the new pop up box, tick the make world file box and set zoom to 17. Click the [Generate] button and prepare to wait while GMAP does its stuff. The dialog box reported 1 of 1054. This is not going to take a lot of time.
After a few seconds there is a .png and .pngw file on the desktop. Renamed and moved to the tutorial directory. The .png file is the graphics file while the renamed .pgw file is the Global Position data text file.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic03.png[/image]

Pic03.

The .png image file of the selected area is 98MB. It needs to be 3MB or less without sacrificing too much image detail. The ingame image is;

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic04.png[/image]

Pic04.

This zoom level is good. You can determine what targets need to be taken out on a unit basis to effectively shut down this facility on what you actually see. Unfortunately the file size is too large for this simulation programme to handle in quantity.

What we reduce in image we increase in scale factor.

In your graphics programme, you load up this .png file. Apply a 50% reduction in file size and save.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic05.png[/image]

Pic05

We are going from 163MB to 40MB (in Photoshop it adds the alpha layer so file sizes are increased as it processes). The red arrow shows the origin of the GP image as defined in the .pgw file. By reducing the image we have shrunk the image size by 50%, yet lost 75% of the actual data using the graphics programme algorithm. The quality of the compression is a factor of what programme you are using.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic06.png[/image]

Pic06.

The image is way off! How do we correct it? The answer is in the .pgw file. The contents are;

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic07.png[/image]

Pic07.

In this particular case, the structure of the .pgw file is;

01 Latitude Scale Factor
02 Top Left Hand Latitude (Offset?)
03 Top Left Hand Longitude (Offset?)
04 Longitude Scale Factor
05 Top Left Hand Longitude actual Global Position location
06 Top Left Hand Latitude actual Global Position location

Because the image was reduce by 50% the scale factor must be doubled.
The lines 01 and 04 get doubled and edited into the .pgw file. That yields for the file contents of;

0.000021457672
0.0000000
0.0000000
-0.000016620316
-118.284130096436
39.264290857282

After reloading the CO ingame, it shows that the quality is still there but with a much smaller file size. Going from 93MB down to 31.1MB in a single hit.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic08.png[/image]

Pic08.

Applying the technique two more times yielded a 1.98MB file. Not as sharp but you would rarely be viewing the game down to this resolution during game play.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic09.png[/image]

Pic09.

If you really want to, use a sharpen filter to bring back some detail lost.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic10.png[/image]

Pic10.

After using smart sharpen in Photoshop

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic11.png[/image]

Pic11.

There now is a 8km x 8km Red target area that has a pretty accurate CO.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic12.png[/image]

Pic12.

This was using the GMAP 17 zoom for accurate unit position. To now flesh out the surrounding areas, you can now use a general lower quality zoom factor to create and Underlay. In this example 13.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic13.png[/image]

Pic13

After 10 minutes and 1680 tiles later the .png created is 212MB in size. Using the technique twice yields a 16.5MB image. Plus it appears that there is no shift in location.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic14.png[/image]

Pic14.

RESULTS.

After adding the 13 zoom .png first as the underlay, and then adding the 17 zoom .png custom overlay. Some Ingame action screenshots to see if this all works and if it is necessary to convey the actual warfare being simulated.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic15.png[/image]

Pic15.

[image]http://www.brass-em.com/portal/images/stories/cmano/customoverlayguide/pic16.png[/image]

Pic16.

Tomcat84 has shown an excellent technique for processing the transparency issue in his video. Although the resultant images might be better cropped further in to reduce dead space and thus image size. Plus he addresses the fact that underlay images of zoom less than 17 are shifted, the actual 17 zoom gmap capture are geographically correct. (Whew!) The zip size comparison may be for another thread.

I hope you get the idea behind the process, it can be applied to all graphics. Many thanks to Warfare Sims LTD, the Slitherine Group and Matrix games for another great simulation game.

Good Hunting.

Brassem.






Tomcat84 -> RE: A guide to reduce your Custom Overlay file sizes. (10/6/2013 11:37:04 AM)

Would love to read this. if you PM me i will post the link for you?




Tomcat84 -> RE: A guide to reduce your Custom Overlay file sizes. (10/6/2013 12:57:14 PM)

That is unfortunate as I would very much like to know how to reduce the overlay filesize




SilentHunter -> RE: A guide to reduce your Custom Overlay file sizes. (10/6/2013 4:51:54 PM)

me too




Tomcat84 -> RE: A guide to reduce your Custom Overlay file sizes. (10/7/2013 6:12:51 AM)

Nice!!!! Looking forward to trying this. Also curious about part two as I've been wondering myself if there is a way to blend it in.
Also I wondered if it was possible to use jpg instead of png to reduce size but didn't seem to work




brassem -> RE: A guide to reduce your Custom Overlay file sizes. (10/7/2013 6:51:01 AM)

Going to investigate further. The .png file format has some problems with transparency. I've found .jpg can causes some horrible graphics distortions if the compression is too much. I've never used .jpg ingame so I will report what I find.




Tomcat84 -> RE: A guide to reduce your Custom Overlay file sizes. (10/7/2013 7:40:15 AM)

Maybe tga would work for transparency?




chemkid -> RE: A guide to reduce your Custom Overlay file sizes. (10/7/2013 12:34:04 PM)

.




JiminyJickers -> RE: A guide to reduce your Custom Overlay file sizes. (10/7/2013 9:35:32 PM)

Thanks, very useful guide.




SilentHunter -> RE: A guide to reduce your Custom Overlay file sizes. (10/7/2013 10:50:55 PM)

Brilliant > Brassem < Brilliant

Thank you I was not able to use those huge files previously in Command, but can now using your guide. I'm wanting to convert areas the size of state of Florida in the United States, which Gmap will do at zoom level 13 but no higher due to limitations with GMAP unless you cut down on the size. Command would never load those files, I assume due to the sheer size 700+ MEG. Your process literally cut my 700 Meg file down to 32 MEG and command now loads it without issue. I was basically able to get half of Nevada converted at zoom 13 and loaded in game now which I could not do prior, being able to layer on top more detailed areas at zoom 15 and 17 is exactly what I was hoping for. Good job!

Now, my stretch dream is how do we get whole countries into command at zoom 17 in one shot !




Tomcat84 -> RE: A guide to reduce your Custom Overlay file sizes. (10/24/2013 9:07:45 PM)

This should really be stickied because it is awesome




brassem -> RE: A guide to reduce your Custom Overlay file sizes. (10/25/2013 9:19:02 AM)

Thanks guys,

If it is to be stickied, could the mods remove my wasted "10 posts before I can link an image" posts.




Dimitris -> RE: A guide to reduce your Custom Overlay file sizes. (10/25/2013 9:23:38 AM)

Done [:)]

And thanks!




Tomcat84 -> RE: A guide to reduce your Custom Overlay file sizes. (10/25/2013 10:53:31 AM)

You didn't actually sticky it though I think? lol [:)]

[edit] it is now :)




Rudd -> RE: A guide to reduce your Custom Overlay file sizes. (7/15/2014 12:09:41 AM)

Wow! I too had a hard time loading some overlay files and I've been reluctant to try this because of my cpu skill level but this is a really easy way to shrink'em.

for the .png
I'm using paint.net. To resize Image>Resize...> click "By percentage", enter 50%. save

for the .pgw
open with the notepad and double lines 1 and 4. save

It's that easy.

I wish I would of tried this sooner.

Thanks guys






darkhelix -> RE: A guide to reduce your Custom Overlay file sizes. (4/2/2016 6:09:01 PM)

I have made several overlays for various missions.
Sometimes the map is offset by a small amount but enough that it appears 1cm offset with the border outlines in game.
I know that I can manually (tediously) correct this in the .pgw file but wonder why, if I give coordinates taken from the game, that the overlay is not a perfect match.
Does this have something to do with curvature of the earth or is it something else?
Thanks,
Toby




AgustusGlue -> RE: A guide to reduce your Custom Overlay file sizes. (3/23/2017 6:12:03 PM)

What a great option. I compress the image in Microsoft Publisher. That converts it from 960 dpi to 96 dpi. Then I just remove a zero from line one and four. It changed a 94 mb image to 1500 kb. It's still in color and still looks pretty decent. Good enough for targeting, anyway.




Grouiiik -> RE: A guide to reduce your Custom Overlay file sizes. (3/12/2018 7:39:55 PM)

Hi all,

I have modified GMap Net to adapt it to Command.

I can't post sites url yet, so :
it's on github
/Grouiiik/greatmaps/releases

New functions are :
Same Latitude and longitude format as in the game
BingSatelliteMap selected by default
You can choose a destination folder
Both generated files have the right extension
The image is automatically resize, with max size, and the Global Position data text file change accordingly !

I hope it will help you making faster overlays.

If you have advices, i will take them all !

And sorry for my english...




ClaudeJ -> RE: A guide to reduce your Custom Overlay file sizes. (2/11/2022 1:57:21 PM)

Hey there,

I'm still getting up to speed with CMO (with I'm having so much fun right now, it feels like catching up with an old friend).

Are custom overlay files still a thing in CMO ?




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
3.361328