Accurate image-based medical diagnosis relies upon adequate image quality and clarity. This has important implications for clinical diagnosis, and for emerging methods such as telemedicine and computer-based image analysis. In this study, we trained a convolutional neural network (CNN) to automatically assess the quality of retinal fundus images in a representative ophthalmic disease, retinopathy of prematurity (ROP). 6,043 wide-angle fundus images were collected from preterm infants during routine ROP screening examinations. Images were assessed by clinical experts for quality regarding ability to diagnose ROP accurately, and were labeled "acceptable" or "not acceptable." The CNN training, validation and test sets consisted of 2,770 images, 200 images, and 3,073 images, respectively. Test set accuracy was 89.1%, with area under the receiver operating curve equal to 0.964, and area under the precision-recall curve equal to 0.966. Taken together, our CNN shows promise as a useful prescreening method for telemedicine and computer-based image analysis applications. We feel this methodology is generalizable to all clinical domains involving image-based diagnosis.