Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The bigger the theory the better.


devel / comp.lang.tcl / svg image size

SubjectAuthor
* svg image sizesaitology9
`* svg image sizeRobert Heller
 `* svg image sizesaitology9
  +* svg image sizeRich
  |`* svg image sizeRobert Heller
  | `- svg image sizesaitology9
  `- svg image sizeRobert Heller

1
svg image size

<tt5cpr$1i0oe$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10782&group=comp.lang.tcl#10782

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: saitolo...@gmail.com (saitology9)
Newsgroups: comp.lang.tcl
Subject: svg image size
Date: Wed, 22 Feb 2023 10:36:26 -0500
Organization: A noiseless patient Spider
Lines: 4
Message-ID: <tt5cpr$1i0oe$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 22 Feb 2023 15:36:27 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0e81e43b3a009f83697da3cd4042b05b";
logging-data="1639182"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RmgxBlsAnA6YW4cxxYq2p"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.3.2
Cancel-Lock: sha1:lBNC46ozs841S8z5grVMx0WUSeY=
Content-Language: en-US
 by: saitology9 - Wed, 22 Feb 2023 15:36 UTC

Hello,

Is there a way to get the width/height of svg images without creating
them as images first?

Re: svg image size

<rtKcnfJK_MDl32v-nZ2dnZfqn_udnZ2d@giganews.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10783&group=comp.lang.tcl#10783

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!border-1.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 22 Feb 2023 16:27:36 +0000
MIME-Version: 1.0
From: hel...@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.15)
Subject: Re: svg image size
In-Reply-To: <tt5cpr$1i0oe$1@dont-email.me>
References: <tt5cpr$1i0oe$1@dont-email.me>
Newsgroups: comp.lang.tcl
Content-Type: text/plain;
charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <rtKcnfJK_MDl32v-nZ2dnZfqn_udnZ2d@giganews.com>
Date: Wed, 22 Feb 2023 16:27:36 +0000
Lines: 22
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-jrg+TV/7zxgeI6ITj71mocqRjCRAc9uGuEzZ220NkrKmwVfwHe1G1o7ZppYvQ/PJQn92GX7YHjzPYrt!CyKW3+i1eACf6v3qwPs4tsEiGTOdCtTiUQNOg6bNDPxFYeBz4+MqpVecgYny2foqeunt3+J6w2jz!1Dk=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Robert Heller - Wed, 22 Feb 2023 16:27 UTC

SVG files are just XML (text) files. Load one of the XML libraries and
read/parse the XML (I have a nifty SNIT class for that in my ModelRRSystem:
https://github.com/RobertPHeller/ModelRRSystem/blob/master/trunk/Scripts/Common/ParseXML.tcl).
In the <svg> tag are attributes for image size and coordinate space in use --
width, height, and viewBox.

At Wed, 22 Feb 2023 10:36:26 -0500 saitology9 <saitology9@gmail.com> wrote:

>
> Hello,
>
> Is there a way to get the width/height of svg images without creating
> them as images first?
>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

Re: svg image size

<tt5tmc$1jrso$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10784&group=comp.lang.tcl#10784

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: saitolo...@gmail.com (saitology9)
Newsgroups: comp.lang.tcl
Subject: Re: svg image size
Date: Wed, 22 Feb 2023 15:24:42 -0500
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <tt5tmc$1jrso$1@dont-email.me>
References: <tt5cpr$1i0oe$1@dont-email.me>
<rtKcnfJK_MDl32v-nZ2dnZfqn_udnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 22 Feb 2023 20:24:44 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="06548b8e920b45e99a6426b801804c7b";
logging-data="1699736"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GINx4k+SP3XbNnMXapuNO"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.3.2
Cancel-Lock: sha1:qKxB7tm/OjoqXLIbTe7H/bc6jaA=
Content-Language: en-US
In-Reply-To: <rtKcnfJK_MDl32v-nZ2dnZfqn_udnZ2d@giganews.com>
 by: saitology9 - Wed, 22 Feb 2023 20:24 UTC

On 2/22/2023 11:27 AM, Robert Heller wrote:
> SVG files are just XML (text) files. Load one of the XML libraries and
> read/parse the XML (I have a nifty SNIT class for that in my ModelRRSystem:
> https://github.com/RobertPHeller/ModelRRSystem/blob/master/trunk/Scripts/Common/ParseXML.tcl).
> In the <svg> tag are attributes for image size and coordinate space in use --
> width, height, and viewBox.
>

Thank you. The width/height seem to be optional as some svg files don't
have them. I am not sure about the viewbox property.

Wouldn't a regexp be a better solution here?

Re: svg image size

<tt5uj5$1jv0g$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10785&group=comp.lang.tcl#10785

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: svg image size
Date: Wed, 22 Feb 2023 20:40:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <tt5uj5$1jv0g$1@dont-email.me>
References: <tt5cpr$1i0oe$1@dont-email.me> <rtKcnfJK_MDl32v-nZ2dnZfqn_udnZ2d@giganews.com> <tt5tmc$1jrso$1@dont-email.me>
Injection-Date: Wed, 22 Feb 2023 20:40:05 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a411ae5f5ece72b9b2901e430edc4628";
logging-data="1702928"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vLvt72gpCcECLBJyDluVa"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:WXklWXLGZJwf0uH0EjPUt+O7yY0=
 by: Rich - Wed, 22 Feb 2023 20:40 UTC

saitology9 <saitology9@gmail.com> wrote:
> On 2/22/2023 11:27 AM, Robert Heller wrote:
>> SVG files are just XML (text) files. Load one of the XML libraries
>> and read/parse the XML (I have a nifty SNIT class for that in my
>> ModelRRSystem:
>> https://github.com/RobertPHeller/ModelRRSystem/blob/master/trunk/Scripts/Common/ParseXML.tcl).
>> In the <svg> tag are attributes for image size and coordinate space
>> in use -- width, height, and viewBox.
>>
>
> Thank you. The width/height seem to be optional as some svg files
> don't have them. I am not sure about the viewbox property.

Keep in mind that the notion of a width/height of an SVG is somewhat of
an odd question. The "S" in SVG stands for scalable and the "V" for
vector, and because they are scalable vectors, they can be any size you
want them to be. The only meaningful value for an SVG would be the
required aspect ratio to represent it without distortion.

Reality is many will indicate a "size" value in the xml, but that
should be taken more as a "suggestion" than a hard fact as such a size
would be for a bit-map graphic image.

> Wouldn't a regexp be a better solution here?

Not as a general XML parsing solution. Regular expressions are not
expressive enough to fully parse the entirety of the XML specification.

With that said, for a specific XML variant (i.e., SVG's) and for
looking for a very specific attribute therein (a suggested
width/height, should it exist) you /can/ use a regex and it should work
in most instances.

Re: svg image size

<_tucnbklnqZdGGv-nZ2dnZfqnPudnZ2d@giganews.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10786&group=comp.lang.tcl#10786

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 22 Feb 2023 21:14:40 +0000
MIME-Version: 1.0
From: hel...@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.15)
Subject: Re: svg image size
In-Reply-To: <tt5tmc$1jrso$1@dont-email.me>
References: <tt5cpr$1i0oe$1@dont-email.me>?
<rtKcnfJK_MDl32v-nZ2dnZfqn_udnZ2d@giganews.com>
<tt5tmc$1jrso$1@dont-email.me>
Newsgroups: comp.lang.tcl
Content-Type: text/plain;
charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <_tucnbklnqZdGGv-nZ2dnZfqnPudnZ2d@giganews.com>
Date: Wed, 22 Feb 2023 21:14:40 +0000
Lines: 45
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-fC1YtBi0wgf0nBAgaC+yWNOmjbqc/CDvQsXS2a1pwA09WGavaeQY3TUVTnU0O3rHJ+GIjzKWsbk8dLv!6W7M5swmuGWefOjCQvw47f+XS83UJ9F+NgNDvthPOL5atNKmifWcquG+J/0VFWDm9xF6DgmYOZKg!mdo=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Robert Heller - Wed, 22 Feb 2023 21:14 UTC

At Wed, 22 Feb 2023 15:24:42 -0500 saitology9 <saitology9@gmail.com> wrote:

>
> On 2/22/2023 11:27 AM, Robert Heller wrote:
> > SVG files are just XML (text) files. Load one of the XML libraries and
> > read/parse the XML (I have a nifty SNIT class for that in my ModelRRSystem:
> > https://github.com/RobertPHeller/ModelRRSystem/blob/master/trunk/Scripts/Common/ParseXML.tcl).
> > In the <svg> tag are attributes for image size and coordinate space in use --
> > width, height, and viewBox.
> >
>
> Thank you. The width/height seem to be optional as some svg files don't
> have them. I am not sure about the viewbox property.

The width/height propertiesare sometimes used to specific a *physical* size
(in inches or millimeters, etc.). The viewBox property can be used to specific
the coordinate bounding box, and thus the mapping of the coordinates in the
body of the file to "screen" (or paper or whatever) coordinates.

For example this Fritzing breadboard image:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: FritzingPartsSVGEditor 0.0.2 on x86_64-unknown-linux-gnu (BreadboardEditor) -->
<svg viewBox="0.000000 0.000000 47.565543 33.295880" width="4.756554mm" x="0mm" height="3.329588mm" y="0mm" version="1.1" xml:space="preserve">
<g id="breadboard">
<circle fpe:gid="1" cx="17.266292134831453" cy="16.647940074906355" r="16.0" fill="none" stroke="black" stroke-width="2.0"/>
<circle fpe:gid="2" id="connector1pin" cx="17.266292134831453" cy="16.64794007490637" r="4.999999999999999" fill="black"/>
<circle fpe:gid="3" id="connector2pin" cx="42.66629213483144" cy="16.64794007490637" r="4.9999999999999964" fill="black"/>
</g>
</svg>

defines a part that is "physically" 4.756554mm by 3.329588mm, with the
coordinates in tenths of a mm.

>
> Wouldn't a regexp be a better solution here?
>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

Re: svg image size

<CgqdnS7Gd99dGGv-nZ2dnZfqn_ednZ2d@giganews.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10787&group=comp.lang.tcl#10787

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.22.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 22 Feb 2023 21:14:40 +0000
MIME-Version: 1.0
From: hel...@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.15)
Subject: Re: svg image size
In-Reply-To: <tt5uj5$1jv0g$1@dont-email.me>
References: <tt5cpr$1i0oe$1@dont-email.me> <rtKcnfJK_MDl32v-nZ2dnZfqn_udnZ2d@giganews.com> <tt5tmc$1jrso$1@dont-email.me> <tt5uj5$1jv0g$1@dont-email.me>
Newsgroups: comp.lang.tcl
Content-Type: text/plain; charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <CgqdnS7Gd99dGGv-nZ2dnZfqn_ednZ2d@giganews.com>
Date: Wed, 22 Feb 2023 21:14:40 +0000
Lines: 51
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-Iv5SFLF5TT86HpSAOrEcQpLLLF9RvxIElRGQpwzMJp46UhB9ku0No9G+cDDifMjguIWKM1H3iglH+8u!GV232d9Qpmjk9FCWiW9S3ZFvUNh8AHZzcanhoRU4AEOc7MLDj5DNpQ4L5icqW7Z10WE3oQCNbJ2Y!PYg=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 3743
 by: Robert Heller - Wed, 22 Feb 2023 21:14 UTC

At Wed, 22 Feb 2023 20:40:05 -0000 (UTC) Rich <rich@example.invalid> wrote:

>
> saitology9 <saitology9@gmail.com> wrote:
> > On 2/22/2023 11:27 AM, Robert Heller wrote:
> >> SVG files are just XML (text) files. Load one of the XML libraries
> >> and read/parse the XML (I have a nifty SNIT class for that in my
> >> ModelRRSystem:
> >> https://github.com/RobertPHeller/ModelRRSystem/blob/master/trunk/Scripts/Common/ParseXML.tcl).
> >> In the <svg> tag are attributes for image size and coordinate space
> >> in use -- width, height, and viewBox.
> >>
> >
> > Thank you. The width/height seem to be optional as some svg files
> > don't have them. I am not sure about the viewbox property.
>
> Keep in mind that the notion of a width/height of an SVG is somewhat of
> an odd question. The "S" in SVG stands for scalable and the "V" for
> vector, and because they are scalable vectors, they can be any size you
> want them to be. The only meaningful value for an SVG would be the
> required aspect ratio to represent it without distortion.
>
> Reality is many will indicate a "size" value in the xml, but that
> should be taken more as a "suggestion" than a hard fact as such a size
> would be for a bit-map graphic image.
>
> > Wouldn't a regexp be a better solution here?
>
> Not as a general XML parsing solution. Regular expressions are not
> expressive enough to fully parse the entirety of the XML specification.
>
> With that said, for a specific XML variant (i.e., SVG's) and for
> looking for a very specific attribute therein (a suggested
> width/height, should it exist) you /can/ use a regex and it should work
> in most instances.

Tcl *does* have several XML parsing libraries, so it is not really to parse
things properly. If one is dealing with svgs from a variaty of sources,
using regexp is going to be hard to get working in all cases of legit SVG
files, since different programs will include (or not) the attributes one is
looking for in different places or order.

>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

Re: svg image size

<tt64lk$1kklv$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10788&group=comp.lang.tcl#10788

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: saitolo...@gmail.com (saitology9)
Newsgroups: comp.lang.tcl
Subject: Re: svg image size
Date: Wed, 22 Feb 2023 17:23:47 -0500
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <tt64lk$1kklv$1@dont-email.me>
References: <tt5cpr$1i0oe$1@dont-email.me>
<rtKcnfJK_MDl32v-nZ2dnZfqn_udnZ2d@giganews.com>
<tt5tmc$1jrso$1@dont-email.me> <tt5uj5$1jv0g$1@dont-email.me>
<CgqdnS7Gd99dGGv-nZ2dnZfqn_ednZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 22 Feb 2023 22:23:48 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="06548b8e920b45e99a6426b801804c7b";
logging-data="1725119"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19luoZKIpgJx7IopvS3wE+U"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.3.2
Cancel-Lock: sha1:37+WLTt2aoJcwurDQnt0XYO7K5Q=
In-Reply-To: <CgqdnS7Gd99dGGv-nZ2dnZfqn_ednZ2d@giganews.com>
Content-Language: en-US
 by: saitology9 - Wed, 22 Feb 2023 22:23 UTC

On 2/22/2023 4:14 PM, Robert Heller wrote:
> At Wed, 22 Feb 2023 20:40:05 -0000 (UTC) Rich <rich@example.invalid> wrote:
>>
>> With that said, for a specific XML variant (i.e., SVG's) and for
>> looking for a very specific attribute therein (a suggested
>> width/height, should it exist) you /can/ use a regex and it should work
>> in most instances.
>
> Tcl *does* have several XML parsing libraries, so it is not really to parse
> things properly. If one is dealing with svgs from a variaty of sources,
> using regexp is going to be hard to get working in all cases of legit SVG
> files, since different programs will include (or not) the attributes one is
> looking for in different places or order.
>
>>
>>
>

Thank you both for the info. I knew about svg files but I hadn't worked
with them before. These are quite small svg image files so really either
option would work fine.


devel / comp.lang.tcl / svg image size

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor