473,378 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

imageTTFText with GD2, problems converting from pixels to points

hi everyone,

i created a script that outputs an image (transparent with text) based
on parameters passed by $_GET.
everything in my application works with 'pixels' and since GD2 this
function (imagettftext) uses 'points' as the text size unit.

i've searched everywhere for a solution to convert from pixels to
points (or the other way around) but with no luck... each place says
something different and i can't find a good answer.

any ideas of how to solve this?

thanks a lot!
nitzan.

Sep 20 '07 #1
1 4165

"Nitzan Tomer" <ni**********@gmail.comwrote in message
news:11*********************@19g2000hsx.googlegrou ps.com...
hi everyone,

i created a script that outputs an image (transparent with text) based
on parameters passed by $_GET.
everything in my application works with 'pixels' and since GD2 this
function (imagettftext) uses 'points' as the text size unit.

i've searched everywhere for a solution to convert from pixels to
points (or the other way around) but with no luck... each place says
something different and i can't find a good answer.

any ideas of how to solve this?

thanks a lot!
nitzan.
Hi,
as far as I know pixels are for (computer) screens, and points are for
printing.

1 point (assuming Postscript) = 1/72 th of an inch
( http://www.cl.cam.ac.uk/~mgk25/metric-typo/ )

How those relate depends on the resolution of the screen.
The resolution of your screen depends on the screen settings, and is not a
fixed value.
Some people assume 72 DPI for screen. Some OS's use 96 DPI. Most of the time
you can adjust DPI somewhere in computer settings. For Windows that used to
be for type only, not for images.

Basically it all means: there is no real way to convert between points and
pixels... because there is no general relationship between the two.

I usually try until things look good on as much screens I can try it on.
How is that for helping you? ;-)

Good luck,
Richard.

Sep 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John Wellesz | last post by:
Hi, since I've upgraded to php 4.3.4 (before I used 4.1.2) I have a problem with imagettftext(): when executing the line: imagettftext($im, 20, 0, 10, 25, $white, "$script_dir/verdana.ttf",...
3
by: Leif Wessman | last post by:
From: http://www.php.net/manual/en/function.imagettftext.php "color is the color index. Using the negative of a color index has the effect of turning off antialiasing." I'm using a bundled...
1
by: Axier | last post by:
I cannot get the swedish character set on images. What can be wrong? I would very much appreciate help. regards, axier I can supply some code here and a link:...
0
by: ljb | last post by:
The PHP manual has this note regarding the GD imagettftext() function: size The font size. Depending on your version of GD, this should be specified as the pixel size (GD1) or point size (GD2)....
1
by: binderup | last post by:
PHP 4.3.11 on Ubuntu Linux with GD2 I have compiled and installed PHP with these arguments: './configure' '--with-apxs=/www/bin/apxs' '--with-zlib' '--enable-exif' '--with-gd'...
12
by: Laphan | last post by:
Hi All Strange question this, but could somebody tell me what the old size=1, size=2 .... to size=7 font parameters are in pixels and points. I thought it was: size 1 = 7 pt size 2 = 14...
1
by: Steve Belanger | last post by:
Hi, i am creating a 'design online' flash tool that allows me to design something with flash, throwing graphics and text elements. i then export that using XML data and have PHP create a jpeg...
3
by: headware | last post by:
I have to create some vertical text for a web page that allows users to print to labels. We decided to do this by creating an <imgtag on the web page and having the src attribute point to another...
11
by: blickensdoerfer | last post by:
i have a problem using ImageTTFText: I want a Text in Arial , 8pt, without Anti-Aliasing . The result is very ugly, how can i get it proper like it would be displayed in the browser window or...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.