What is the unit of ImageFont.textsize() returned values?
up vote
1
down vote
favorite
I am trying to use PIL to precompute the size that a given line of text will take at a given font and size. PIL seemed to be more or less the only working solution.
I am not sure what is the unit of the returned value of font.textsize(..)
. The doc doesn't specify it.
The reason why I am asking is because I am confused by the returned values as mentioned here: ImageFont.textsize() seems wrong
python python-imaging-library
add a comment |
up vote
1
down vote
favorite
I am trying to use PIL to precompute the size that a given line of text will take at a given font and size. PIL seemed to be more or less the only working solution.
I am not sure what is the unit of the returned value of font.textsize(..)
. The doc doesn't specify it.
The reason why I am asking is because I am confused by the returned values as mentioned here: ImageFont.textsize() seems wrong
python python-imaging-library
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am trying to use PIL to precompute the size that a given line of text will take at a given font and size. PIL seemed to be more or less the only working solution.
I am not sure what is the unit of the returned value of font.textsize(..)
. The doc doesn't specify it.
The reason why I am asking is because I am confused by the returned values as mentioned here: ImageFont.textsize() seems wrong
python python-imaging-library
I am trying to use PIL to precompute the size that a given line of text will take at a given font and size. PIL seemed to be more or less the only working solution.
I am not sure what is the unit of the returned value of font.textsize(..)
. The doc doesn't specify it.
The reason why I am asking is because I am confused by the returned values as mentioned here: ImageFont.textsize() seems wrong
python python-imaging-library
python python-imaging-library
asked Nov 8 at 10:36
Vic Seedoubleyew
83
83
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
The units are pixels, so it tells you how large a canvas you would need to accommodate the text.
There is no reason it should be the same as any other product's text size.
There is occasionally a small discrepancy of 3-4 pixels, probably as a result of anti-aliasing.
Thanks a lot for the answer! In that case I don't really get how to compute the size of how much space a given text would take if printed. It seems that pillow assumes a given resolution?
– Vic Seedoubleyew
2 days ago
Pillow is not in the least bit interested in print sizes or resolutions, it only works in pixels, the same as pretty much all image processing tools. You can make something 100 pixels wide or 1,000 pixels wide and the dpi is completely irrelevant until you come to print it. At that point, if you say you want 300 dpi, your 100 pixels will print at 1/3 inch and your 1,000 pixels will print at 3.3 inches. dpi is just a number you can change at any point - the true measure of how much "quality" you have is how many pixels you have.
– Mark Setchell
2 days ago
Thanks a lot for sharing! I guess I can find out which resolution my supplier uses for printing, and thus the number of pixels I have. I know the font size I use, which is 9 pt. However it seems like I should in some way multiply that by the resolution, and pass the result to pillow as font size? Otherwise, if I just pass 9 to pillow, it seems that the result would not take into account the amount of pixels I have available. Am I understanding correctly? Thanks again very much for your help
– Vic Seedoubleyew
yesterday
Yes, exactly... you seem to have the idea of it now.
– Mark Setchell
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
The units are pixels, so it tells you how large a canvas you would need to accommodate the text.
There is no reason it should be the same as any other product's text size.
There is occasionally a small discrepancy of 3-4 pixels, probably as a result of anti-aliasing.
Thanks a lot for the answer! In that case I don't really get how to compute the size of how much space a given text would take if printed. It seems that pillow assumes a given resolution?
– Vic Seedoubleyew
2 days ago
Pillow is not in the least bit interested in print sizes or resolutions, it only works in pixels, the same as pretty much all image processing tools. You can make something 100 pixels wide or 1,000 pixels wide and the dpi is completely irrelevant until you come to print it. At that point, if you say you want 300 dpi, your 100 pixels will print at 1/3 inch and your 1,000 pixels will print at 3.3 inches. dpi is just a number you can change at any point - the true measure of how much "quality" you have is how many pixels you have.
– Mark Setchell
2 days ago
Thanks a lot for sharing! I guess I can find out which resolution my supplier uses for printing, and thus the number of pixels I have. I know the font size I use, which is 9 pt. However it seems like I should in some way multiply that by the resolution, and pass the result to pillow as font size? Otherwise, if I just pass 9 to pillow, it seems that the result would not take into account the amount of pixels I have available. Am I understanding correctly? Thanks again very much for your help
– Vic Seedoubleyew
yesterday
Yes, exactly... you seem to have the idea of it now.
– Mark Setchell
yesterday
add a comment |
up vote
0
down vote
accepted
The units are pixels, so it tells you how large a canvas you would need to accommodate the text.
There is no reason it should be the same as any other product's text size.
There is occasionally a small discrepancy of 3-4 pixels, probably as a result of anti-aliasing.
Thanks a lot for the answer! In that case I don't really get how to compute the size of how much space a given text would take if printed. It seems that pillow assumes a given resolution?
– Vic Seedoubleyew
2 days ago
Pillow is not in the least bit interested in print sizes or resolutions, it only works in pixels, the same as pretty much all image processing tools. You can make something 100 pixels wide or 1,000 pixels wide and the dpi is completely irrelevant until you come to print it. At that point, if you say you want 300 dpi, your 100 pixels will print at 1/3 inch and your 1,000 pixels will print at 3.3 inches. dpi is just a number you can change at any point - the true measure of how much "quality" you have is how many pixels you have.
– Mark Setchell
2 days ago
Thanks a lot for sharing! I guess I can find out which resolution my supplier uses for printing, and thus the number of pixels I have. I know the font size I use, which is 9 pt. However it seems like I should in some way multiply that by the resolution, and pass the result to pillow as font size? Otherwise, if I just pass 9 to pillow, it seems that the result would not take into account the amount of pixels I have available. Am I understanding correctly? Thanks again very much for your help
– Vic Seedoubleyew
yesterday
Yes, exactly... you seem to have the idea of it now.
– Mark Setchell
yesterday
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
The units are pixels, so it tells you how large a canvas you would need to accommodate the text.
There is no reason it should be the same as any other product's text size.
There is occasionally a small discrepancy of 3-4 pixels, probably as a result of anti-aliasing.
The units are pixels, so it tells you how large a canvas you would need to accommodate the text.
There is no reason it should be the same as any other product's text size.
There is occasionally a small discrepancy of 3-4 pixels, probably as a result of anti-aliasing.
answered Nov 8 at 16:31
Mark Setchell
83.4k568167
83.4k568167
Thanks a lot for the answer! In that case I don't really get how to compute the size of how much space a given text would take if printed. It seems that pillow assumes a given resolution?
– Vic Seedoubleyew
2 days ago
Pillow is not in the least bit interested in print sizes or resolutions, it only works in pixels, the same as pretty much all image processing tools. You can make something 100 pixels wide or 1,000 pixels wide and the dpi is completely irrelevant until you come to print it. At that point, if you say you want 300 dpi, your 100 pixels will print at 1/3 inch and your 1,000 pixels will print at 3.3 inches. dpi is just a number you can change at any point - the true measure of how much "quality" you have is how many pixels you have.
– Mark Setchell
2 days ago
Thanks a lot for sharing! I guess I can find out which resolution my supplier uses for printing, and thus the number of pixels I have. I know the font size I use, which is 9 pt. However it seems like I should in some way multiply that by the resolution, and pass the result to pillow as font size? Otherwise, if I just pass 9 to pillow, it seems that the result would not take into account the amount of pixels I have available. Am I understanding correctly? Thanks again very much for your help
– Vic Seedoubleyew
yesterday
Yes, exactly... you seem to have the idea of it now.
– Mark Setchell
yesterday
add a comment |
Thanks a lot for the answer! In that case I don't really get how to compute the size of how much space a given text would take if printed. It seems that pillow assumes a given resolution?
– Vic Seedoubleyew
2 days ago
Pillow is not in the least bit interested in print sizes or resolutions, it only works in pixels, the same as pretty much all image processing tools. You can make something 100 pixels wide or 1,000 pixels wide and the dpi is completely irrelevant until you come to print it. At that point, if you say you want 300 dpi, your 100 pixels will print at 1/3 inch and your 1,000 pixels will print at 3.3 inches. dpi is just a number you can change at any point - the true measure of how much "quality" you have is how many pixels you have.
– Mark Setchell
2 days ago
Thanks a lot for sharing! I guess I can find out which resolution my supplier uses for printing, and thus the number of pixels I have. I know the font size I use, which is 9 pt. However it seems like I should in some way multiply that by the resolution, and pass the result to pillow as font size? Otherwise, if I just pass 9 to pillow, it seems that the result would not take into account the amount of pixels I have available. Am I understanding correctly? Thanks again very much for your help
– Vic Seedoubleyew
yesterday
Yes, exactly... you seem to have the idea of it now.
– Mark Setchell
yesterday
Thanks a lot for the answer! In that case I don't really get how to compute the size of how much space a given text would take if printed. It seems that pillow assumes a given resolution?
– Vic Seedoubleyew
2 days ago
Thanks a lot for the answer! In that case I don't really get how to compute the size of how much space a given text would take if printed. It seems that pillow assumes a given resolution?
– Vic Seedoubleyew
2 days ago
Pillow is not in the least bit interested in print sizes or resolutions, it only works in pixels, the same as pretty much all image processing tools. You can make something 100 pixels wide or 1,000 pixels wide and the dpi is completely irrelevant until you come to print it. At that point, if you say you want 300 dpi, your 100 pixels will print at 1/3 inch and your 1,000 pixels will print at 3.3 inches. dpi is just a number you can change at any point - the true measure of how much "quality" you have is how many pixels you have.
– Mark Setchell
2 days ago
Pillow is not in the least bit interested in print sizes or resolutions, it only works in pixels, the same as pretty much all image processing tools. You can make something 100 pixels wide or 1,000 pixels wide and the dpi is completely irrelevant until you come to print it. At that point, if you say you want 300 dpi, your 100 pixels will print at 1/3 inch and your 1,000 pixels will print at 3.3 inches. dpi is just a number you can change at any point - the true measure of how much "quality" you have is how many pixels you have.
– Mark Setchell
2 days ago
Thanks a lot for sharing! I guess I can find out which resolution my supplier uses for printing, and thus the number of pixels I have. I know the font size I use, which is 9 pt. However it seems like I should in some way multiply that by the resolution, and pass the result to pillow as font size? Otherwise, if I just pass 9 to pillow, it seems that the result would not take into account the amount of pixels I have available. Am I understanding correctly? Thanks again very much for your help
– Vic Seedoubleyew
yesterday
Thanks a lot for sharing! I guess I can find out which resolution my supplier uses for printing, and thus the number of pixels I have. I know the font size I use, which is 9 pt. However it seems like I should in some way multiply that by the resolution, and pass the result to pillow as font size? Otherwise, if I just pass 9 to pillow, it seems that the result would not take into account the amount of pixels I have available. Am I understanding correctly? Thanks again very much for your help
– Vic Seedoubleyew
yesterday
Yes, exactly... you seem to have the idea of it now.
– Mark Setchell
yesterday
Yes, exactly... you seem to have the idea of it now.
– Mark Setchell
yesterday
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205954%2fwhat-is-the-unit-of-imagefont-textsize-returned-values%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password