Pneumonia is an acute respiratory disease that contributes to a high global mortality rate. Clinical identification typically utilizes chest x-rays; however, manual analysis by medical practitioners is prone to subjectivity and is time-consuming. Therefore, this research designs an automatic classification system to recognize pneumonia utilizing a Convolutional Neural Network (CNN) while assessing the effectiveness of various image enhancement methods. During the initial preprocessing phase, data balancing was conducted through the random undersampling technique to reduce the majority class, generating a balanced dataset of 1,000 training images for each category. Image pixel quality was then improved using logarithmic transformation, Histogram Equalization (HE), Contrast Limited Adaptive Histogram Equalization (CLAHE), and gamma correction. The model performance evaluation involved Base CNN, VGG-16, and EfficientNet-V2 architectures, which were validated using a stratified 5-fold cross-validation scheme. The experimental findings indicated that combining the VGG-16 architecture with the HE technique yielded the most optimal detection performance. This model achieved an accuracy of 93.44%, precision of 97.30%, recall of 89.40%, F1-score of 93.17%, and an Area Under the Curve (AUC) score of 0.9845. On the other hand, the EfficientNet-V2 model showed suboptimal performance on this dataset, which is indicated to be caused by the implementation of frozen layers during the training process.