The incomplete and untrue data caused by cyber attacks (e.g., image information leakage and tampering) will affect control performance and even lead to system instability. To address this problem, a novel co-design secure control method based on image attack detection and data compensation for networked visual control systems (NVCSs) is proposed. Firstly, the existing problems of NVCSs under image attacks are analyzed, and a co-design secure control method including image encryption, watermarking-based attack detection and online data compensation is presented. Then, a detector based on doublelayer detection mechanism of timeout and digital watermarking is designed for real-time, integrity and authenticity discrimination of the image. Furthermore, according to the detection results, an online compensation scheme based on cubic spline interpolation and post-prediction update is proposed to reduce the effect of cumulative errors and improve control performance. Finally, the online compensation scheme is optimized by considering the characters of networked inverted pendulum visual control systems, and experimental results demonstrate the feasibility and effectiveness of the proposed detection and control method.