Changing PHP GD Library to increase image quality -
we implemented parametric image generator creates images contain texts dynamic sizes using php gd library.
in order create printable image, need increase image quality 500 dpi.
can give guidance on how extend this?
imagejpegdocs takes argument image quality. defaults 75, can increase maximum of 100. example:
imagejpeg($canvas, null, 90);
however, generated graphics lots of continuous colours , sharp lines, jpeg not best choice. pngs more well-suited these sorts of images, , give perfect quality @ smaller size. imagepng[docs] has few options, defaults should fine:
header('content-type: image/png'); imagepng($canvas);
you're using imagecreate
docs make image in first place. creates "pallet-based" image: 1 can use limited number of colours. matches lower quality of gif or 8-bit png, because you're not using formats should use imagecreatetruecolor
docs instead. far, image simple , might not make difference, matter if you're generating more complicated images.
if make these 2 changes, images sure have perfect quality.
Comments
Post a Comment