The medical image processing has shown promising development in this digital era. The autodetection of white blood cell (leukocytes) is the challenging problem in medical image processing. Leukocytes play important role as immune cells that fight the infectious agents when entering the body. Since, distinguishing leukocytes have essential key in medical field to diagnosis diseases, this paper presents a system for distinguishing and classifying WBC types which are neutrophil, lymphocytes, eosinophils and monocytes using K-Nearest Neighbor (K-NN) and Random Forest (RF). The purpose of this study is to improve the accuracy of K-NN and RF algorithm to classify White Blood Cells (WBCs) images. Here, images are enhanced by using shock filtering equation in pre-processing before classification. In the conducting study, the highest average accuracy in classifying WBCs images is 72.69% and the lowest accuracy is 63.81% using random forest algorithm. Meanwhile in K-NN algorithm, the accuracy is obtained increasing up to 8%.