JPEG compression is one of the major image compression methods and is widely used on the Internet. In addition, identifying traces of JPEG compression and double JPEG compression (DJPEG) is crucial in the image forensics field. Therefore, JPEG compression detection and DJPEG compression detection are two of the popular image authentication methods. Many feature-based JPEG detection methods have been proposed for that purpose, and there have been outstanding improvements in DJPEG detection with the development of deep learning. A number of anti-forensics of JPEG detection that counter feature-based detectors have been proposed but only a few techniques that counter DJPEG have been researched. This paper explores whether JPEG reconstruction methods, including restoration and anti-forensics of JPEG detection, can deceive JPEG and DJPEG detectors. We demonstrate that existing anti-forensics of JPEG detection can deceive both JPEG and DJPEG detectors well but perform poorly in non-aligned cases and degrade the image quality. We propose a convolutional neural network (CNN) based anti-forensics method to improve the performance of anti-forensics so that they can proficiently deceive JPEG and DJPEG detectors with higher image quality. Moreover, we explore the generalization algorithm to handle the real scenario.