Detect text or pixel outside ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Daniel_in_the_sky
Posts: 13
Joined: 2009-07-27T05:04:53-07:00
Authentication code: 8675309

Detect text or pixel outside ?

Post by Daniel_in_the_sky »

Hi everybody,

Im actually working on a script generating randoms designs, including text...

I would like to "detect" when the text is going outside the "picture"/"working area".

there is a comand for that ?

Thank you
D.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Detect text or pixel outside ?

Post by anthony »

Not easilly. Simplest would be to use a larger image than look for some change outside the areas concerned.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Daniel_in_the_sky
Posts: 13
Joined: 2009-07-27T05:04:53-07:00
Authentication code: 8675309

Re: Detect text or pixel outside ?

Post by Daniel_in_the_sky »

Thank you for your anser.
I see...
"the artistic force" of this idea is the randomless of evrything, the picture keep the same size.
I have to find a way to detect pixels outside, (of the text) and then bring it back inside the area.....
the text is random has well of course ^_^

Maybe... by knowing the width of the text. and adding the X position xtext + xpicture ? if > total width of the picture ?

So there is a command to know the width of the text ? haha i think this direction is worst

D.
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Detect text or pixel outside ?

Post by GreenKoopa »

You could generate a label: of a specified -size, or create a label: and then -crop it. Do you know how you would handle too much text if you could detect it overflowing? Yes, you can determine the width of the new label: canvas.
Post Reply