This study systematically evaluates and compares the effectiveness of two deep learning architectures, VGG16 and ResNet50, in automating electrocardiogram (ECG) image classification for cardiac condition diagnosis. The dataset was obtained from a public source and consists of 2,898 color ECG images converted from raw signals, categorized into four classes: Abnormal Heartbeat, Myocardial Infarction, Normal Individual, and History of Heart Attack. The data underwent preprocessing steps including resizing to 224×224 pixels, pixel normalization to a 0–1 range, label encoding, one-hot encoding, and an 80:20 split for training and testing. Transfer learning was applied using feature representations from the VGG16 and ResNet50 models, employing the Adam optimizer and categorical cross-entropy loss function. To enhance training efficiency and prevent overfitting, early stopping was implemented based on validation loss performance. Model performance was evaluated using accuracy, precision, recall, and F1-score metrics. The results showed that VGG16 achieved 95% accuracy with a loss of 0.1522, precision of 95%, recall of 94%, and F1-score of 94%. In contrast, ResNet50 attained 81% accuracy with a loss of 0.5730, precision of 82%, recall of 79%, and F1-score of 80%. These findings indicate that, within the context of this study, VGG16 consistently outperformed ResNet50 across all evaluation metrics in the ECG image classification task. Therefore, the application of transfer learning using the VGG16 model demonstrates strong potential as an effective approach for AI-based ECG image classification systems.