Page 1 of 1

GEORGE : tv_imageGetBound layerID iPosition

Posted: 28 Nov 2013, 09:55
by Mads Juul
I woulld like a George Command wich could return the bounding box of an given image of a given layer in the current clip
So if I had a drawing like this:
tv_imageGetBound00000.png
tv_imageGetBound00000.png (55.57 KiB) Viewed 20118 times
And a george script like this

Code: Select all

tv_imageGetBound layerID iPosition
bound = result // Returns 131 115 379 455 with this image
tv_rect bound
Would produce his result
tv_imageGetBound00001.png
tv_imageGetBound00001.png (55.57 KiB) Viewed 20118 times
If I had a blue pen as selected tool
-Mads

Re: GEORGE : tv_imageGetBound

Posted: 28 Nov 2013, 12:10
by ZigOtto
+1

+ to get a "Marching Ants" bounding box with tv_SelectRect Bound
tv_imageGetBound02.png
tv_imageGetBound02.png (57.73 KiB) Viewed 20106 times

Re: GEORGE : tv_imageGetBound

Posted: 28 Nov 2013, 12:33
by Elodie
Ok, let's todolist this.

Re: GEORGE : tv_imageGetBound

Posted: 28 Nov 2013, 12:51
by Mads Juul
Elodie wrote:Ok, let's todolist this.
cool :D
ZigOtto wrote:+1
tv_SelectRect Bound
Is there A George Command like this?
I dont think it is possible to manipulate the Selection with George. Or?

Re: GEORGE : tv_imageGetBound

Posted: 28 Nov 2013, 13:06
by Elodie
No, I don't think so, that's why I am about to todolist all the content of this conversation ^^

Re: GEORGE : tv_imageGetBound

Posted: 28 Nov 2013, 13:23
by Mads Juul
2XCool :D

Re: GEORGE : tv_imageGetBound

Posted: 28 Nov 2013, 14:50
by ZigOtto
madsjuul wrote:
ZigOtto wrote:+1
tv_SelectRect Bound
Is there A George Command like this?
I dont think it is possible to manipulate the Selection with George. Or?
I was completing your feature request with mine which is in the same family,
so just a future request added to yours. :wink:
Elodie wrote:... that's why I am about to todolist all the content of this conversation ^^
3xcool ! :)

Re: GEORGE : tv_imageGetBound

Posted: 10 Feb 2014, 08:56
by Mads Juul
I'm Looking forward to the tv_imageGetBound Feature!

Re: GEORGE : tv_imageGetBound

Posted: 15 May 2014, 01:08
by Svengali
madsjuul wrote:I'm Looking forward to the tv_imageGetBound Feature!
Until then here's a George version you can adapt...

Code: Select all

// tvImageBound.grg
// Svengali©2014 - All Rights Reserved
// Version .02 - May 14, 2014 - Draw and undraw bounding box around drawing

Param none

tv_GetActiveTool
OriginalTool = result							// store tool
parse result ToolType d							// get tool type

IF CMP(ToolType,"tv_restorebrush")
	tv_BrushToClipboard								// store CutBrush
END
tv_GetAPen
APen = result									// store APen color
tv_GetWidth
Width = result									// get project dimensions
tv_GetHeight
Height = result

tv_UndoOpenStack								// suspend undo stack
tv_BrushCut 0 0 Width Height 0					// grab a copy of the current image

tv_BrushRestore OptimizeSource 1				// get pixels' bounding box


tv_GetActiveTool								// get info on the CutBrush from the current image
parse result d d d d Width1 d Height1 d d d d d d d d d d d d d d d d d d d d origineX origineY d

tv_setAPen 200 0 0								// set APen to red

x1 = origineX - 1									// get upper left X corner of CutBrush within project
y1 = origineY - 1									// get upper left Y corner of CutBrush within project
x2 = origineX + Width1							// calculate lower right X corner of CutBrush within project
y2 = origineY + Height1							// calculate lower right Y corner of CutBrush within project

tv_Propelling RESET 1							// select single pixel tool

tv_Rect x1 y1 x2 y2								// draw red bounding box rectangle

tv_WaitButton 1									// wait for mouse LMB down click

IF CMP(ToolType,"tv_restorebrush")
	tv_BrushFromClipboard						// retrieve original CutBrush
END

tv_UndoCloseStack								// reinstate undo stack
tv_Undo											// remove red bounding box
tv_UpdateUndo									// reinstate original image

tv_SetAPen APen									// reset original APen color
tv_cmd OriginalTool								// restore original Tool
Sven

Re: GEORGE : tv_imageGetBound

Posted: 15 May 2014, 15:24
by Mads Juul
Yes thank. But I made my own script like that a couple of yars ago. But it is slow and there is problems attached with it. If i got a custombrush before i run the script, how to getcit back after. For instance. And I cant call it on another instance on another layer. What if I wanted to find the imagebound on an entire layer? Then it gets slow. But thankt you anyways svend. Maybe your script is better than mine I will look into it. But i still look forward to the george sunction :D