When I have come across this problem, it has always been because I've tried to save a file in a folder that doesn't exist.
An example:
image.Save(@"c:\Documents\Test\Test.bmp",...)
This fails with 'A generic error occurred in GDI+' if the folders 'C:\Documents' or 'C:\Documents\Test' do not exist.
Verify the complete path you are trying to write to exists. You may wish to start by verifying that your string replacements are working as you expect.