The "A generic error occurred in GDI+" message basically means that whatever your array of bytes contains, it is not recognisable as an image:
Image returnImage = Image.FromStream(ms);
Is failing.
Check your data - have you passed the name of a image file instead of it's content?
[edit]
I must read questions a bit more carefully!
The chances are that if it works normally, then fails on scheduled execution it isn't the image load that is the problem - it's the save.
Scheduled tasks do not run with the same user as "normal" applications, and there is a very good chance that the folder you are trying to save the file to does not have write permissions for the user that is executing the scheduled task.
Change the folder permissions to "any user full access" and you should be fine.
[/edit]