|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I am trying to render an 8 pixel pixel font without anti aliasing to
look crisp (silkscreen) in 8pt with gd. the font is huge and ugly: <?php // Set the content-type header("Content-type: image/png"); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'silkscreen.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> -- any ideas? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
nihilism machine schreef:
> I am trying to render an 8 pixel pixel font without anti aliasing to > look crisp (silkscreen) in 8pt with gd. the font is huge and ugly: > > <?php > // Set the content-type > header("Content-type: image/png"); > > // Create the image > $im = imagecreatetruecolor(400, 30); > > // Create some colors > $white = imagecolorallocate($im, 255, 255, 255); > $grey = imagecolorallocate($im, 128, 128, 128); > $black = imagecolorallocate($im, 0, 0, 0); > imagefilledrectangle($im, 0, 0, 399, 29, $white); > > // The text to draw > $text = 'Testing...'; > // Replace path by your own font path > $font = 'silkscreen.ttf'; > > // Add some shadow to the text > imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); > > // Add the text > imagettftext($im, 20, 0, 10, 20, $black, $font, $text); > > // Using imagepng() results in clearer text compared with imagejpeg() > imagepng($im); > imagedestroy($im); > ?> > > > -- any ideas? don't post twice. use '8' instead of '20' for the fontsize. > |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Monday 17 March 2008 09:25:36 Jochem Maas wrote:
> nihilism machine schreef: > > I am trying to render an 8 pixel pixel font without anti aliasing to > > look crisp (silkscreen) in 8pt with gd. the font is huge and ugly: > > > > <?php > > // Set the content-type > > header("Content-type: image/png"); > > > > // Create the image > > $im = imagecreatetruecolor(400, 30); > > > > // Create some colors > > $white = imagecolorallocate($im, 255, 255, 255); > > $grey = imagecolorallocate($im, 128, 128, 128); > > $black = imagecolorallocate($im, 0, 0, 0); > > imagefilledrectangle($im, 0, 0, 399, 29, $white); > > > > // The text to draw > > $text = 'Testing...'; > > // Replace path by your own font path > > $font = 'silkscreen.ttf'; > > > > // Add some shadow to the text > > imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); > > > > // Add the text > > imagettftext($im, 20, 0, 10, 20, $black, $font, $text); > > > > // Using imagepng() results in clearer text compared with imagejpeg() > > imagepng($im); > > imagedestroy($im); > > ?> > > > > > > -- any ideas? > > don't post twice. I recon he didn't. This list has the tendancy to send double posts from time to time. > use '8' instead of '20' for the fontsize. -- --- Børge Holen http://www.arivene.net |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Børge Holen schreef:
> On Monday 17 March 2008 09:25:36 Jochem Maas wrote: >> nihilism machine schreef: >>> I am trying to render an 8 pixel pixel font without anti aliasing to >>> look crisp (silkscreen) in 8pt with gd. the font is huge and ugly: >>> >>> <?php >>> // Set the content-type >>> header("Content-type: image/png"); >>> >>> // Create the image >>> $im = imagecreatetruecolor(400, 30); >>> >>> // Create some colors >>> $white = imagecolorallocate($im, 255, 255, 255); >>> $grey = imagecolorallocate($im, 128, 128, 128); >>> $black = imagecolorallocate($im, 0, 0, 0); >>> imagefilledrectangle($im, 0, 0, 399, 29, $white); >>> >>> // The text to draw >>> $text = 'Testing...'; >>> // Replace path by your own font path >>> $font = 'silkscreen.ttf'; >>> >>> // Add some shadow to the text >>> imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); >>> >>> // Add the text >>> imagettftext($im, 20, 0, 10, 20, $black, $font, $text); >>> >>> // Using imagepng() results in clearer text compared with imagejpeg() >>> imagepng($im); >>> imagedestroy($im); >>> ?> >>> >>> >>> -- any ideas? >> don't post twice. > > I recon he didn't. maybe, maybe not. I get punished for stuff I didn't do all the time ... why shouldn't he ;-) > This list has the tendancy to send double posts from time to time. it does? haven't noticed that. I'll be more vigilant (well I'll try) > >> use '8' instead of '20' for the fontsize. > > > |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Monday 17 March 2008 13:10:20 Jochem Maas wrote:
> Børge Holen schreef: > > On Monday 17 March 2008 09:25:36 Jochem Maas wrote: > >> nihilism machine schreef: > >>> I am trying to render an 8 pixel pixel font without anti aliasing to > >>> look crisp (silkscreen) in 8pt with gd. the font is huge and ugly: > >>> > >>> <?php > >>> // Set the content-type > >>> header("Content-type: image/png"); > >>> > >>> // Create the image > >>> $im = imagecreatetruecolor(400, 30); > >>> > >>> // Create some colors > >>> $white = imagecolorallocate($im, 255, 255, 255); > >>> $grey = imagecolorallocate($im, 128, 128, 128); > >>> $black = imagecolorallocate($im, 0, 0, 0); > >>> imagefilledrectangle($im, 0, 0, 399, 29, $white); > >>> > >>> // The text to draw > >>> $text = 'Testing...'; > >>> // Replace path by your own font path > >>> $font = 'silkscreen.ttf'; > >>> > >>> // Add some shadow to the text > >>> imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); > >>> > >>> // Add the text > >>> imagettftext($im, 20, 0, 10, 20, $black, $font, $text); > >>> > >>> // Using imagepng() results in clearer text compared with imagejpeg() > >>> imagepng($im); > >>> imagedestroy($im); > >>> ?> > >>> > >>> > >>> -- any ideas? > >> > >> don't post twice. > > > > I recon he didn't. > > maybe, maybe not. I get punished for stuff I didn't do all the time ... why > shouldn't he ;-) THAT on the other hand is a perfectly good reason to kick the shit out of someone =D > > > This list has the tendancy to send double posts from time to time. > > it does? haven't noticed that. I'll be more vigilant (well I'll try) > > >> use '8' instead of '20' for the fontsize. -- --- Børge Holen http://www.arivene.net |
|
![]() |
| Outils de la discussion | |
|
|