It depends. The specific example you gave is for an XSS exploit, which is not an exploit of image viewers or decoders. Modifying such an image may destroy the malicious code, depending on the kind of exploit. If the image is corrupt such that it will exploit an image viewer, editing the image in any way (including resizing it) will very likely pass it through the same vulnerable decoder (e.g. libpng) as the one used by an image viewer. Consider this simplified view of how an image editor works:
A source image is passed through a decoder which converts it into a pixel map.
Any modifications to the image are made to this raw pixel map, in memory.
The pixel map is compressed and converted into a standard image format.
Now compare this to how an image viewer works:
A source image is passed through a decoder which converts it into a pixel map.
The pixel map is displayed directly on the screen.
The first step in both instances are the same. Unfortunately, this step is where the vulnerable image decoding library is affected. In many cases, modifying an image is actually worse because the decoders are often more complex in order to support a wider variety of obscure formats and features.