I had a friend named "tommy" that hated bloated software. He followed guides like this [1] to experimentally delete files off his box. Backup, delete stuff, see if everything works. If works, new incremental backup and repeat. If not, restore and make note to keep that. The result over a few years: a WinXP install with Firefox, AV, Office Suite, etc that backed up fully on a 650MB CD. Mindboggling.
Note: It was a blessing and a curse. He was a Windows XP holdover despite security issues and his preference for security. He wouldn't transition. The reason? He invested too much time into his XP box to give it up. Plus, looking at the Win7 default install, he figured it would be less fun next time.
I wonder if it would be possible to do this semi-automatically. Boot it in a VM, check what is actually accessed during boot / a couple programs starting up / running. ("Just" automate this.) Remove the files / parts of files, check that everything still works. If yes, repeat. If no, try binary searching until you get something that does work. Repeat.
Someone got a Linux image that could run `ls` down to 6.12MB by intercepting file accesses and deleting anything unused... See "How I shrunk a Docker image by 98.8%" (https://news.ycombinator.com/item?id=9438323)
It's an overly simple method but a good start. Will work if the dependencies are static and load at runtime. I don't know enough about the tool to say if it works for more dynamic applications.
Nice thinking but I'm not sure it's a great idea. The reason, which I warned tommy, was that there's plenty of code in there for significant situations that are uncommon or even rare. You'd have to pick out about every way you'd configure, run, maintain, and so on a binary program to exercise all its relevant functionality. You'd also have to hit it with various errors to be sure they're within the same libraries. Otherwise, you're risking leaving out something critical and it will be hard to figure out by the time trimming is done.
For this reason, I thought about using Windows Embedded as it has configuration tools to strip out most unnecessary things while being compatible with whatever you want. That plus stripping guides. Alternatively, stick with tommy's stripping-style method. Either way, you eventually have a set of files you turn into an image with proprietary or open tools along with configuration scripts to make it unique. That has many advantages in addition to size in terms of administration, backup, and even security.
Note: It was a blessing and a curse. He was a Windows XP holdover despite security issues and his preference for security. He wouldn't transition. The reason? He invested too much time into his XP box to give it up. Plus, looking at the Win7 default install, he figured it would be less fun next time.