Pneumonia poses a significant risk of mortality, particularly in individuals with compromised immune systems, necessitating early diagnosis and treatment to combat the disease effectively. In this study, we employed Multilayer Perceptron (MLP) and k-Nearest Neighbors (k-NN) machine learning (ML) algorithms to facilitate pneumonia diagnosis using preprocessed Chest X-ray images. Preprocessing steps, including Histogram Equalization, Mask R-CNN (Mask Region-Based Convolutional Neural Network), and Otsu thresholding, were successively performed on the images. Textural features were subsequently extracted from the Chest X-ray images and utilized as inputs for the classification algorithms. To address the imbalanced class problem in the training data, the Synthetic Minority Over-sampling Technique (SMOTE) was implemented. Classification evaluation metrics included accuracy, precision, recall, F1-Score, and AUC Score (Area Under Curve Score). The results revealed that the MLP algorithm outperformed the k-NN algorithm across all metrics. Furthermore, a comparison of the MLP and k-NN algorithms with previous studies in the literature demonstrated the superiority of the MLP algorithm, achieving an accuracy of 95.673%, F1-Score of 95.706%, and AUC Score of 99.006%. This study highlights the potential of employing the MLP algorithm for highly accurate pneumonia diagnosis using Chest X-ray images.