Hi, I have the same problem when using 2012 27" iMac.
One day when working on Photoshop the screen became like this- vertical stripes with changing colors.
When I connect it to TBD, the iMac works flawless. Even the brightness on iMac can be adjusted, but the screen didn't show anything but stripes of different colors.
Any help from other member? I'd like to know it's a graphic card issue and can be fixed. Thanks a lot~!