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.
Here is my code:
Thanks for any help
Code: Select all
MagickReadImage($resource2,"test.jpg"); MagickSetImageUnits( $resource2, MW_PixelsPerInchResolution ); MagickSetImageResolution( $resource2, 300, 300 ); PixelSetColor($pixelr, "white"); DrawSetFont($doodler, "arial.ttf"); DrawSetFontSize($doodler, 20); DrawSetFillColor($doodler, $pixelr); MagickAnnotateImage( $resource2, $doodler, 100, 100, 0, "Hello World" ); //$aa=MagickGetImageResolution( $resource2 ); //echo $aa."-".$aa;