I have an image that I am sampling at 300DPI. I am then trying to write some text on it. It works OK, but the issue is that it looks like the text was written on to an image which is in fact 72DPI or something... i.e. the text is relatively tiny compared to the actual height and width of the image.

For example, if you go to photoshop or whatever, and create 2x 400x400 images, one at 72DPI and one at 300DPI, you will see that writing text at font size 20 (for example) gives wildly differing results (i.e. one one the text looks large, as the image is actually only 2" high or something, and on the other it looks small as the image is really 5" high due to pixel density). Mine looks more like the latter. i.e. I am actually writing my 20pt text onto a low DPI image.

If I echo the resolution that IM claims the image to be, it is indeed 300 DPI.