The objectives of the research reported in this Research Communication were to compare the variation of hind quarter skin surface temperature pre- and post- milking in dairy cows and to determine the optimal time to capture images by infrared thermography for improving the sensitivity and specificity of mastitis detection in dairy cows. Hind quarter infrared images of 102 Holstein dairy cows were captured from the caudal view by an infrared camera pre-milking and post-milking. The udder skin surface temperature was measured with the help of the image processing software. No significant difference was found between the left and right quarter skin surface temperature pre- and post- milking. The hind quarter skin surface temperature pre-milking was not significantly influenced by milk yield, but exhibited a rising trend along with the increase of milk yield. The hind quarter skin surface temperature post-milking was significantly influenced by milk yield. This leads us to conclude that the sensitivity and specificity of IRT in mastitis detection may be influenced by milk yield and it may be better to capture the infrared images of cow udders pre-milking.