Supposing there are a series of photographs of portraits that are in the public domain, but the images all have the frames in shot.
I don't think the frame should be in shot, so I write a bash script to remove the frames in bulk. Not only has a great deal of technical sophistry gone into this (I'd be surprised if 2% of the general population were capable of doing that), but the resulting .jpegs are set up in a way that I have dictated, based on my personal artistic preferences.
Are these new images in the public domain?
My gut feeling says they should be, but I don't see the difference between your actions and mine.
Whilst I don't know enough copyright law to know if the NPG is in the right or not, as a UK taxpayer I'm firmly against this legal action. Our culture is enriched by these images; let them be free!