Chest X-rays are among the most common modalities in medical imaging. Technical flaws of these images, such as over- or under-exposure or wrong positioning of the patients can result in a decision to reject and repeat the scan. We propose an automatic method to detect images that are not suitable for diagnostic study. If deployed at the point of image acquisition, such a system can warn the technician, so the repeat image is acquired without the need to bring the patient back to the scanner. We use a deep neural network trained on a dataset of 3487 images labeled by two experienced radiologists to classify the images as diagnostic or non-diagnostic. The DenseNet121 architecture is used for this classification task. The trained network has an area under the receiver operator curve (AUC) of 0.93. By removing the X-rays with diagnostic quality issues, this technology could potentially provide significant cost savings for hospitals.