So fairly recently, I've merged my fascination with extremely large images with my fascination of fractals. The output of which was a handful of BMP files, some of which happen to be 18000 by 18000 pixels. To give you some perspective, that’s a 324 megapixels image (or ~309 megapixels for those of us who still subscribe to the fact that mega means 1048576 and not 1000000). I've been using uncompressed BMP files just because they are extremely easy to stream out, this means that the memory and processing requirements at generation time are very light (which is good because fractal generation can be a very CPU intensive process). The downside is that afterwards I'm left with a 927 megabyte file. So now I just need an easy way to convert these to something a little more manageable...
Photoshop offers a huge automation infrastructure, which allows you to run script files within the application. But you can also use COM and external scripts (or apps) to drive it as well. This gives me an avenue to automate the task of converting my bitmap files into smaller PNG files from the command line.
var ps = WScript.CreateObject("Photoshop.Application");
var doc = ps.Open("C:\\sample.bmp");
var pngOptions = WScript.CreateObject("Photoshop.PNGSaveOptions");
doc.SaveAs("C:\\sample.png", pngOptions, true);
doc.Close(2); // don't save the file
For those that want to browse the entire object model, you can open up "C:\Program Files\Adobe\Photoshop CS\Plug-Ins\Adobe Photoshop Only\Automate\ScriptingSupport.8li" (at least that is the file in version 8) in a viewer like Visual Studio's oleview.exe (you may need to temporarily rename the ScriptingSupport file to give it a .dll or .exe extension).
Documentation on the object model can be found on the Adobe devnet site, or in your installation directory.