Tools like PNGOUT blithely strip out color profiles (the iCCP chunk), which arguably makes the tools lossy because it changes the appearance of non-sRGB images in nearly all modern browsers.
I've found a solution. Gimp will offer to autoconvert to sRGB when opening an affected image. Saving and using PNGOUT is then perfectly fine. The original and Gimp-assisted recompressed images will give identical screenshots from a browser to the extent that every pixel will have the same RGB value with both image files. This is exactly what I want.
However, I'm dealing with hundreds of images and opening them in Gimp this way and then saving them is not an automated process. How can I automatically properly convert PNGs to the sRGB color profile prior to recompressing them?
Note: I've tried ImageMagick's convert with various sRGB.icc profiles, but every time I've tried it's a bit lossy (like giving #cccdcc instead of #cccccc) and thus ruins the ability to use PNG's greyscale storage for grey images, both of which are undesired.