Converting Pixels to mm

I recently started using morphometry in my studies but now that we acquired some new equipment, I'm a little bit lost. Does anybody know how can I convert my pixels to mm? For example, I took a photo of a ruler in which I can see 5mm. According to the program, this corresponds to 500 pixels (zoom = 0,8X). So, how can I make a standard "conversion number" so that always when I measured my stuff, I just multiply the pixels by a number and have the exactly mm as a result?
The photos I will take will be in a higher zoom than 0,8.