Fwd: Stupid question - object's dimensions
![](https://secure.gravatar.com/avatar/b2dc087f43d1dd5db52c95b09b601da2.jpg?s=120&d=mm&r=g)
Is this using a python extension to inkscape, or in an external application?
If an extension, you can call another instance of inkscape passing the --query-all parameter and get a list of all the bounding boxes for every object in the svg file.
-Rob A>
On Jan 31, 2008 12:37 AM, M. Bashir Al-Noimi wrote:
Hi All :-) ,
I want to calculate dimensions of the following object:
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="430pt" height="648pt" viewBox="0 0 430 648" preserveAspectRatio="xMidYMid meet"> <g transform="translate(0,648) scale(0.040000,-0.040000)" fill="#000000" stroke="none"> <path d="M6837 16034 c-4 -4 -4 -11 -1 -16 6 -10 24 -1 24 13 0 10 -14 12 -23 3z"/>
How I can do that?
I tried the following, but I'm sure it's wrong.
Calc Left point: Left = XM*Scale_X = 6837*0.040000 = 273.48
Calc Bottom point: Bottom = YM*Scale_Y = 16034*ABS(-0.040000) = 641.36
Converting c point to C: -4 -4 -4 -11 -1 -16 6 -10 24 -1 24 13 0 10 -14 12 -23 3 273.32 641.2 273.32 640.92 273.44 640.72 273.72 640.96 274.44 641.32 274.44 641.88 273.48 641.76 272.92 641.84 272.56 641.48
Calc Width as following: Width = X_MAX-X_MIN = 274.44-272.56 = 1.88
Calc Height as following: Height = Y_MAX-Y_MIN = 641.88-640.72 = 1.16
-- Best Regards تحياتي Muhammad Bashir Al-Noimi محمد بشير النعيمي
My Blog مدونتي http://mbnoimi.net/
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
![](https://secure.gravatar.com/avatar/8e43c2e5124926349162f4e0e98b00ee.jpg?s=120&d=mm&r=g)
Rob Antonishen wrote:
Is this using a python extension to inkscape, or in an external application?
I'm using external application, so I'm asking you, because SVG file format is the major format in Inkscape, and I couldn't find any info about my question in w3c website.
Hi All :-) ,
I want to calculate dimensions of the following object:
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="430pt" height="648pt" viewBox="0 0 430 648"آ preserveAspectRatio="xMidYMid meet"> <g transform="translate(0,648) scale(0.040000,-0.040000)" fill="#000000" stroke="none"> <path d="M6837 16034 c-4 -4 -4 -11 -1 -16 6 -10 24 -1 24 13 0 10 -14 12 -23 3z"/>
*How I can do that?
*I tried the following, but I'm sure it's wrong.
* Calc Left point:
Left = XM*Scale_X = 6837*0.040000 = 273.48
* Calc Bottom point:
Bottom = YM*Scale_Y = 16034*ABS(-0.040000) = 641.36
* Converting c point to C:
-4 -4 -4 -11 -1 -16 6 -10 24 -1 24 13 0 10 -14 12 -23 3
273.32 641.2 273.32 640.92 273.44 640.72 273.72 640.96 274.44 641.32 274.44 641.88 273.48 641.76 272.92 641.84 272.56 641.48
* Calc Width as following:
Width = X_MAX-X_MIN = 274.44-272.56 = 1.88
* Calc Height as following:
Height = Y_MAX-Y_MIN = 641.88-640.72 = 1.16
![](https://secure.gravatar.com/avatar/c88fadb425fbd4141e479ea413437c82.jpg?s=120&d=mm&r=g)
Your method might work if the object were a polygon, but finding the bounding box of a path defined by bezier curves is not trivial. Thankfully, inkscape can do it for you using command-line options (see man inkscape for the details).
So if you save your file to mban.svg (I had to add </g> </svg> at the end to make it valid), you can then run:
$ inkscape --query-width ~/tmp/mban.svg 1.6336524
$ inkscape --query-height ~/tmp/mban.svg 1.6247816
-Tom
On Jan 31, 2008 11:01 AM, M. Bashir Al-Noimi <mhdbnoimi@...400...> wrote:
Rob Antonishen wrote: Is this using a python extension to inkscape, or in an external application?
I'm using external application, so I'm asking you, because SVG file format is the major format in Inkscape, and I couldn't find any info about my question in w3c website.
Hi All :-) ,
I want to calculate dimensions of the following object:
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="430pt" height="648pt" viewBox="0 0 430 648"آ preserveAspectRatio="xMidYMid meet">
<g transform="translate(0,648) scale(0.040000,-0.040000)" fill="#000000" stroke="none"> <path d="M6837 16034 c-4 -4 -4 -11 -1 -16 6 -10 24 -1 24 13 0 10 -14 12 -23 3z"/>
How I can do that?
I tried the following, but I'm sure it's wrong.
Calc Left point: Left = XM*Scale_X = 6837*0.040000 = 273.48
Calc Bottom point: Bottom = YM*Scale_Y = 16034*ABS(-0.040000) = 641.36
Converting c point to C: -4 -4 -4 -11 -1 -16 6 -10 24 -1 24 13 0 10 -14 12 -23 3 273.32 641.2 273.32 640.92 273.44 640.72 273.72 640.96 274.44 641.32 274.44 641.88 273.48 641.76 272.92 641.84 272.56 641.48
Calc Width as following: Width = X_MAX-X_MIN = 274.44-272.56 = 1.88
Calc Height as following: Height = Y_MAX-Y_MIN = 641.88-640.72 = 1.16
-- Best Regards تحياتي Muhammad Bashir Al-Noimi محمد بشير النعيمي
My Blog مدونتي http://mbnoimi.net/
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
![](https://secure.gravatar.com/avatar/8e43c2e5124926349162f4e0e98b00ee.jpg?s=120&d=mm&r=g)
Tom Davidson wrote:
Your method might work if the object were a polygon, but finding the bounding box of a path defined by bezier curves is not trivial. Thankfully, inkscape can do it for you using command-line options (see man inkscape for the details).
So if you save your file to mban.svg (I had to add </g> </svg> at the end to make it valid), you can then run:
$ inkscape --query-width ~/tmp/mban.svg 1.6336524
$ inkscape --query-height ~/tmp/mban.svg 1.6247816
-Tom
On Jan 31, 2008 11:01 AM, M. Bashir Al-Noimi <mhdbnoimi@...400...> wrote:
Rob Antonishen wrote: Is this using a python extension to inkscape, or in an external application?
I'm using external application, so I'm asking you, because SVG file format is the major format in Inkscape, and I couldn't find any info about my question in w3c website.
Hi All :-) ,
I want to calculate dimensions of the following object:
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="430pt" height="648pt" viewBox="0 0 430 648"آ preserveAspectRatio="xMidYMid meet">
<g transform="translate(0,648) scale(0.040000,-0.040000)" fill="#000000" stroke="none"> <path d="M6837 16034 c-4 -4 -4 -11 -1 -16 6 -10 24 -1 24 13 0 10 -14 12 -23 3z"/>
How I can do that?
I tried the following, but I'm sure it's wrong.
Calc Left point: Left = XM*Scale_X = 6837*0.040000 = 273.48
Calc Bottom point: Bottom = YM*Scale_Y = 16034*ABS(-0.040000) = 641.36
Converting c point to C: -4 -4 -4 -11 -1 -16 6 -10 24 -1 24 13 0 10 -14 12 -23 3 273.32 641.2 273.32 640.92 273.44 640.72 273.72 640.96 274.44 641.32 274.44 641.88 273.48 641.76 272.92 641.84 272.56 641.48
Calc Width as following: Width = X_MAX-X_MIN = 274.44-272.56 = 1.88
Calc Height as following: Height = Y_MAX-Y_MIN = 641.88-640.72 = 1.16
I need a solution without using Inkscape, cuz I'm working on small parser for SVG file format, I looked in SVG file format, but its documentation didn't talk about bounding box for curves, so I asked you in Inkscape cuz you did these calculations before.
participants (3)
-
M. Bashir Al-Noimi
-
Rob Antonishen
-
Tom Davidson