Gimp-Forum.net
How to Manipulate Text into Shape? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: How to Manipulate Text into Shape? (/Thread-How-to-Manipulate-Text-into-Shape)

Pages: 1 2 3 4


RE: How to Manipulate Text into Shape? - Espermaschine - 12-18-2017

(12-18-2017, 10:18 AM)Ofnuts Wrote: So, my script-writing neurone has fired. The case where the verticals in the text are kept vertical and the two envelope paths are defined by exactly two points each is not too complicated with some math (and this is really 90% or more of the uses...).


This is of course completely analytical (remapping the path control points, and not creating any new ones as other scripts do)

Still have to make the script more user-proof and document everything...

Stay tuned, but don't hold your breath Smile

I dont know if this is any help with the script writing process, but the external python 'Bezier Envelope Extension' for Inkscape does already a pretty good job.
It works best on individual letters, but when the mapping-path is absolutely perfect (handles perfectly symetrical), it works like a charm on whole text in one go.
Unlike all the Extensions and LPE's that come with Inkscape, which cant process a curved mapping path.

Maybe its worth to have a look at the code, to check how it does this and translate to Gimp ?

https://github.com/shlomif/Bezier-Envelope-for-Inkscape


RE: How to Manipulate Text into Shape? - Ofnuts - 12-18-2017

Basically the same ideas. But that code relies on four external libraries that aren't included in Gimp's Python, and the only benefit I see is that they would allow arbitrary paths (multiple anchors).

However it seems the general envelope (including sides) isn't that different from my current code, so I may give it a shot.

Both that code and mine suffer from the same deficiency, they don't handle perspective: the smaller the letter gets, the narrower it should be. For a general path that could be fairly hairy but if the target is text it could be approximated by computing a perspective transform for each character.

Unless applying a perspective transform after the path has been bent gives acceptable results...


RE: How to Manipulate Text into Shape? - Espermaschine - 12-18-2017

(12-18-2017, 10:59 AM)Ofnuts Wrote: Both that code and mine suffer from the same deficiency, they don't handle perspective: the smaller the letter gets, the narrower it should be. For a general path that could be fairly hairy but if the target is text it could be approximated by computing a perspective transform for each character.

Unless applying  a perspective transform after the path has been bent gives acceptable results...

But we dont need perspective. That is even a different LPE and Extension in Inkscape.
We just need an easy way to warp text into several shapes, like an arch or a flag.

[attachment=1132]

[attachment=1133]




I was wondering.... when i was a teenager (so before personal computers, lol) i used a grid technique to enlarge images with pen and paper.
It must be possible to draw text to a warped grid that has the required curvature with the Bezier Tool as long as its simple text.

[attachment=1135]


RE: How to Manipulate Text into Shape? - Ofnuts - 12-18-2017

If you look at the Cinemascope logo there is a perspective effect:

[Image: cinemascopebanner.gif]

The "E" in "Cinema" is both smaller and narrower than the "E" in "Scope".


RE: How to Manipulate Text into Shape? - Espermaschine - 12-18-2017

(12-18-2017, 01:45 PM)Ofnuts Wrote: If you look at the Cinemascope logo there is a perspective effect:

I stand corrected, although i wonder if this example is an exception.
Was probably handdrawn too.


RE: How to Manipulate Text into Shape? - Ofnuts - 12-18-2017

(12-18-2017, 11:15 AM)Espermaschine Wrote: I was wondering.... when i was a teenager (so before personal computers, lol) i used a grid technique to enlarge images with pen and paper.
It must be possible to draw text to a warped grid that has the required curvature with the Bezier Tool as long as its simple text.

This is more or less how these scripts work, for a point at a given (x,y) they compute a relative position of that Y between the top and bottom horizontals, then find the Yt and Yb coordinates of the envelope paths for that given X(*), and compute the new absolute Y using these two coordinates and the relative position of the initial Y. In my script:

Code:
yRelative=(y-srcTopY)/(srcBotY-srcTopY)
bendTopY=findYforX(topBendCoeffs,x,'top')
bendBotY=findYforX(botBendCoeffs,x,'bottom')
bentY=bendTopY+(bendBotY-bendTopY)*yRelative
where src*Y are the two horizontals, and the *BendCoeffs are the mathematical formulas of the envelope paths.

(*) which is the hard part since it requires to solve a cubic equation


RE: How to Manipulate Text into Shape? - Espermaschine - 12-18-2017

who knew mathematical formulas could smell so much like christmas Tongue


RE: How to Manipulate Text into Shape? - Ofnuts - 12-18-2017

Learn math and every day is Christmas Smile


RE: How to Manipulate Text into Shape? - Espermaschine - 12-18-2017

(12-18-2017, 08:40 PM)Ofnuts Wrote: Learn math and every day is Christmas Smile

my brain isnt wired for math
i had always bad grades in math, with the exception of geometry
there i shined


RE: How to Manipulate Text into Shape? - Ofnuts - 12-18-2017

Well , all this is more or less algebraic geometry Smile