What does offset mean in Pillow?

Asked

Viewed 59 times

-1

The method getoffset() class PIL.ImageFont.FreeTypeFont returns a tuple. What exactly are these measurements?

I use the Pillow in the version 6.1.0.

  • What version of Pillow you refer to?

  • He came to see in documentation?

  • @fernandosavio This is not class PIL.ImageFont.FreeTypeFont?

  • Yep, this documentation made me more confused than deaf in bingo... Ignore my previous comment..

  • Look I do not know, Pillow, but for me such values concern the coordinates x,y in the Cartesian plane of the object in question.

  • Yes, I went to the forum because I also found the documentation very confusing. I refer to version 6.1.0.

  • Anderson, yes class is PIL.ImageFont.Freetypefont. Thanks for the fix, I will edit.

Show 2 more comments

1 answer

0


"offset" means "offset" - The method .getoffset of objects of type "Font" inside the module ImageFont requires a text string - and returns the position, in pixels, from which it would begin to draw text if that text were to be drawn in an image.

For almost all strings the return is "0.0" - if you are not creating a typesetting script, and using very strange special characters, you will not find any case where the return of .getoffset will be different from 0.0 - and, anyway, it is designed to be used internally by the functions that will actually draw the text in the images (using, in general, the method text of an object ImageDraw.Draw - you pass the source as parameter to it, and, the internal use of this method is that you will use .getoffset, .getmask, etc... at the source).

In short:

  • the value is the offset in pixels where the drawing of a font will start
  • the value returned will almost always be (0, 0)
  • you don’t need to call this method directly
  • Thank you very much, jsbueno!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.