473,769 Members | 3,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4243

"Nitzan Tomer" <ni**********@g mail.comwrote in message
news:11******** *************@1 9g2000hsx.googl egroups.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
2143
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", "Test en cours... Oméga: Ω");
3
4416
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 version of GD: 2.0.23 compatible. When using the function imagettftext() with a negative color to get a aliased text as stated in the docs the text gets grainy. Not antialised, and not aliased. Something in between (ugly!). I've tried several fonts....
1
4247
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: http://www.mymobile.nu/services/fontgen/fonttest.php Some people looks like they can get it to work with no effort at all with the same script.
0
1883
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). To accurately use point sizes, PHP+GD would have to know the actual output device resolution, which is impossible. I think PHP+GD just assumes a resolution of 72 pixels per inch, for TrueType font sizing. Therefore 1 point equals 1 pixel, so...
1
2365
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' '--with-mysql=/usr' '--with-mm' '--with-jpeg' '--with-jpeg-dir=/usr' '--with-png' '--with-ttf' And when I run any script created by myself or downloaded I get no errors with imagettftext, but the text is missing on the images. No warnings or notices are given,...
12
2176
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 pt size 3 = 21 pt
1
1552
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 version of what the flash contained. my problem is that i use imagettftext to render my text elements (it can be bolded, italic, different font sizes and different fonts).
3
3137
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 ASP.NET page that generates the image on the fly and streams it back to the browser. It works fine, but I'm worried about sizing issues. The image has to be a specific height and width to fit properly onto the label. The constructor for the...
11
5669
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 photoshop? i tried a lot of things and searched, but did not find a solution to this...help is very much appreciated! thank you
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.