delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2023/10/01/23:44:27

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1696218185; x=1696822985; darn=delorie.com;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=YTLPuhhTduKbsBE/7ZXzWxLLYnvV6Gn/mMhPTz4vz+8=;
b=ZUXFDYtBxnNzIwXBBQG9488LnzAyTTUxrqUIp8R1H231QR37qOuyc45QxzJyQ80IPz
I0kZEL9aK8HvLScsmyEeNc9ruaHoOM8paZiMQQmfhWwZyocg+XaKAD4QbXET4UdQc9KR
qtTSwz4odugTD1o5/12DxCIov+M9TSNh/RNbY59NMHvIkmyVuMwYEZ36y1ZNgLS4gzoC
BC5N1e8MPRlLR/f+inYH9UBTmwvpJpeRu0h3Bm0EnqDUkTZmD37QAff7poFRnT69gfIn
Jp+8Sknwxpr05LijehYhDPsAY/L97wZZYV6MHzhqdnco3cKtk84p5cFm0c1CpT1ECOUo
0vBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1696218185; x=1696822985;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=YTLPuhhTduKbsBE/7ZXzWxLLYnvV6Gn/mMhPTz4vz+8=;
b=tGLVRivA/ZL+6cYXjoImbiIe1zvWQUUJmJ+4QJvKv2OHtax0pu8sEiCAtvfn5tMSm6
qekSxALmtI7eZ36t7CjaA6l3jDLRhCKKPCQBdXp65AwVf+i0okXXN2+F8fEEaDLmfxYv
4gqyZVTk0fO7xETrsl8nIaE1T+q78E2xopH6SJduwb6nE6cIrtVR8oe6pmeh0haTCh62
sedZrnlDvqV7/jdYLQf3zF3xRlpndOAetCdZ6ZIFLiickK81+j/pafHM7Fzs7P/ffv4A
VIQLlgs4GCiLrI8/+pphCL2wsOJnn8hflK58J6d/jkQsRzPPQW8vwIQxhpWU0WrtnjGb
lmBg==
X-Gm-Message-State: AOJu0YzUCWnTRJZqBSmn4T/UNLM3UfVhdmQhmlOT6MVfGFsW3joWrseR
CCpZQHfct62m08cC3jKFZiWv8iAF2di9iKFYyfbczF4G
X-Google-Smtp-Source: AGHT+IHwKID8rOFaRPWmucr1P217n+1lM/sWcp7b9H1Zj1dwjmVBimqixvF1YCPfQBOIaKRaP7ocnIu0nTPQhBkSNvU=
X-Received: by 2002:a05:6e02:1c4d:b0:349:2d48:66ac with SMTP id
d13-20020a056e021c4d00b003492d4866acmr16095244ilg.12.1696218184957; Sun, 01
Oct 2023 20:43:04 -0700 (PDT)
MIME-Version: 1.0
References: <6877754c-dcb7-db34-dd39-419de060ad7a AT linetec DOT nl> <CAHUm0tP6Gwky0CyAFn90Cb-1uc49vy=V0dvwTZcATJFDHrfotQ AT mail DOT gmail DOT com>
In-Reply-To: <CAHUm0tP6Gwky0CyAFn90Cb-1uc49vy=V0dvwTZcATJFDHrfotQ@mail.gmail.com>
From: "Erich Heinzle (a1039181 AT gmail DOT com) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
Date: Mon, 2 Oct 2023 14:12:53 +1030
Message-ID: <CAHUm0tOD5VuJnSMVUAAQwUMu0byJQjEyWv3OsfohV10QRFM=9w@mail.gmail.com>
Subject: Re: [geda-user] PCB silk layer image script
To: geda-user <geda-user AT delorie DOT com>
Reply-To: geda-user AT delorie DOT com

--0000000000006043360606b392df
Content-Type: text/plain; charset="UTF-8"

Two more things

There is a fourth option, also allowing conversion of vector graphics to
pcb layout artwork, namely, the pstoedit utility.

This supports gEDA PCB export, and also supports pcb-rnd export of paths
and polygons; although the current code does not censor self intersecting
polygons when exporting.


Finally, to avoid reinventing the wheel to crop layouts, pcb-rnd has an
autocrop() action which can be invoked from the command line as well, i.e.

echo 'autocrop; save' | pcb-rnd --gui batch input.rp

This will work on any object on any layer.

Regards,

Erich

On Mon, 2 Oct 2023 11:52 Erich Heinzle, <a1039181 AT gmail DOT com> wrote:

> I have three approaches to pcb artwork
>
> The simplest is image2footprint, which works well for bitmap graphics
>
> https://github.com/erichVK5/image2footprint
>
> The catch is, gEDA PCB does not have a distinct soldermask layer that is
> editable, limiting the full range of effects possible.
>
> There are better alternatives for pcb-rnd, including the parametric
> bitmap() footprint which can be launched from the footprint library window
>
> http://repo.hu/cgi-bin/pool.cgi?project=pcb-rnd&cmd=show&node=bitmap
>
> and for more advanced effects, there is the parametric image2footprint
> version for pcb-rnd which does Floyd Steinberg dithering or closest match
> to menu selectable silk screen, copper (ENIG vs Pb/Sn) and solder mask
> colours
>
>
> http://repo.hu/projects/edakrill/user/erichvk/footprint/image2footprint.krill.tar.gz
>
> Finally, for vector artwork, there is the inkscape2pcb extension for
> Inkscape which can save in gEDA PCB and pcb-rnd file formats. Although
> pcb-rnd has native support for gEDA PCB footprints, the inkscape exporter
> takes advantage of the polygon in footprint support of pcb-rnd to export
> any non self intersecting paths as polygons on a distinct layer as well.
> pcb-rnd also allows scaling of any footprint in the buffer.
>
> https://inkscape.org/~erichVK5/%E2%98%85inkscape2pcb
>
> Regards,
>
> Erich
>
>
>
>
> On Sun, 1 Oct 2023 23:50 Richard Rasker (rasker AT linetec DOT nl) [via
> geda-user AT delorie DOT com], <geda-user AT delorie DOT com> wrote:
>
>> Hi all,
>>
>> Every now and then, questions pop up about converting a logo or other
>> image into a silk screen element, and many answers involve a more or less
>> manual process using Inkscape combined with pstoedit. Also see the thread
>> 'PCB jpg to silkscreen' here, starting 7 November 2019.
>>
>> As I found I had to look up the details again every time, I decided to
>> create a script by the name of pcbsilk that automates most of the process
>> -- see attached file. It requires imagemagick, potrace and pstoedit to
>> work, and accepts several common image formats (JPG, PNM as well as EPS).
>>
>> How it works:
>>
>> It first checks whether a width is specified for the resulting silk layer
>> element. If no width is specified, it defaults to 40 mm.
>>
>> Then it checks if the input file is an EPS file already; if not, it uses
>> imagemagick's convert to convert the image to PBM format, which is then fed
>> to potrace to create an EPS file. The resulting EPS file is then converted
>> into a PCB silkscreen element using pstoedit.
>>
>> But even though it works sort of OK, there are a few annoying things that
>> I haven't been able to fix (apart from several smaller refinements):
>>
>> - When specifying width in millimeters,  things work up to 73 millimeters
>> but throw a sort of overflow error above that value:
>>
>> $ pcbsilk -W 74mm testlogo.jpg
>> double free or corruption (!prev)
>> /home/richard/scripts/pcbsilk: line 36: 15520 Aborted
>> (memory dumped) pstoedit -q -f "pcbfill" -ssp $silkname.eps $silkname.pcb
>>
>> The actual size itself does not seem to cause the problem, as inch sizes
>> (e.g. -W 74in) work just fine. So it seems that it is the millimeter units
>> that somehow have a limited range -- not in potrace (where the width is
>> specified), but in pstoedit. I could of course work around the problem by
>> converting millimeter sizes into inches before calling pstoedit, so I think
>> that's what I'll do.
>>
>> - Specifying a width of course also does not work for EPS files, as any
>> scaling is done before conversion to EPS. Is there a way to specify width
>> in pstoedit? Or is there an easy tool to scale an EPS element without
>> having to parse the file myself?
>>
>> - The pstoedit command produces a PCB file with default workspace
>> dimensions (6000 x 5000 mil here), with the silk image at the bottom left.
>> Is it possible to (temporarily) adjust this default to fit the image size?
>>
>> Thanks for comments, corrections and of course solutions!
>>
>> Best regards,
>>
>> Richard Rasker
>>
>

--0000000000006043360606b392df
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Two more things<div dir=3D"auto"><br></div><div dir=3D"au=
to">There is a fourth option, also allowing conversion of vector graphics t=
o pcb layout artwork, namely, the pstoedit utility.</div><div dir=3D"auto">=
<br></div><div dir=3D"auto">This supports gEDA PCB export, and also support=
s pcb-rnd export of paths and polygons; although the current code does not =
censor self intersecting polygons when exporting.</div><div dir=3D"auto"><b=
r></div><div dir=3D"auto"><br></div><div dir=3D"auto">Finally, to avoid rei=
nventing the wheel to crop layouts, pcb-rnd has an autocrop() action which =
can be invoked from the command line as well, i.e.</div><div dir=3D"auto"><=
br style=3D"font-size:12.8px"><span style=3D"font-size:12.8px">echo &#39;au=
tocrop; save&#39; | pcb-rnd --gui batch input.rp</span><br style=3D"font-si=
ze:12.8px"><br></div><div dir=3D"auto">This will work on any object on any =
layer.</div><div dir=3D"auto"><br></div><div dir=3D"auto">Regards,</div><di=
v dir=3D"auto"><br></div><div dir=3D"auto">Erich</div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, 2 Oct 2023 1=
1:52 Erich Heinzle, &lt;<a href=3D"mailto:a1039181 AT gmail DOT com">a1039181 AT gmai=
l.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"au=
to">I have three approaches to pcb artwork<div dir=3D"auto"><br></div><div =
dir=3D"auto">The simplest is image2footprint, which works well for bitmap g=
raphics</div><div dir=3D"auto"><br></div><div dir=3D"auto"><a href=3D"https=
://github.com/erichVK5/image2footprint" target=3D"_blank" rel=3D"noreferrer=
">https://github.com/erichVK5/image2footprint</a><br></div><div dir=3D"auto=
"><br></div><div dir=3D"auto">The catch is, gEDA PCB does not have a distin=
ct soldermask layer that is editable, limiting the full range of effects po=
ssible.</div><div dir=3D"auto"><br></div><div dir=3D"auto">There are better=
 alternatives for pcb-rnd, including the parametric bitmap() footprint whic=
h can be launched from the footprint library window</div><div dir=3D"auto">=
<br></div><div dir=3D"auto"><a href=3D"http://repo.hu/cgi-bin/pool.cgi?proj=
ect=3Dpcb-rnd&amp;cmd=3Dshow&amp;node=3Dbitmap" target=3D"_blank" rel=3D"no=
referrer">http://repo.hu/cgi-bin/pool.cgi?project=3Dpcb-rnd&amp;cmd=3Dshow&=
amp;node=3Dbitmap</a><br></div><div dir=3D"auto"><br></div><div dir=3D"auto=
">and for more advanced effects, there is the parametric image2footprint ve=
rsion for pcb-rnd which does Floyd Steinberg dithering or closest match to =
menu selectable silk screen, copper (ENIG vs Pb/Sn) and solder mask colours=
</div><div dir=3D"auto"><br></div><div dir=3D"auto"><a href=3D"http://repo.=
hu/projects/edakrill/user/erichvk/footprint/image2footprint.krill.tar.gz" t=
arget=3D"_blank" rel=3D"noreferrer">http://repo.hu/projects/edakrill/user/e=
richvk/footprint/image2footprint.krill.tar.gz</a><br></div><div dir=3D"auto=
"><br></div><div dir=3D"auto">Finally, for vector artwork, there is the ink=
scape2pcb extension for Inkscape which can save in gEDA PCB and pcb-rnd fil=
e formats. Although pcb-rnd has native support for gEDA PCB footprints, the=
 inkscape exporter takes advantage of the polygon in footprint support of p=
cb-rnd to export any non self intersecting paths as polygons on a distinct =
layer as well. pcb-rnd also allows scaling of any footprint in the buffer.<=
/div><div dir=3D"auto"><br></div><div dir=3D"auto"><a href=3D"https://inksc=
ape.org/~erichVK5/%E2%98%85inkscape2pcb" target=3D"_blank" rel=3D"noreferre=
r">https://inkscape.org/~erichVK5/%E2%98%85inkscape2pcb</a><br></div><div d=
ir=3D"auto"><br></div><div dir=3D"auto">Regards,</div><div dir=3D"auto"><br=
></div><div dir=3D"auto">Erich</div><div dir=3D"auto"><br></div><div dir=3D=
"auto"><br></div><div dir=3D"auto"><br></div></div><br><div class=3D"gmail_=
quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sun, 1 Oct 2023 23:50 Richa=
rd Rasker (<a href=3D"mailto:rasker AT linetec DOT nl" target=3D"_blank" rel=3D"no=
referrer">rasker AT linetec DOT nl</a>) [via <a href=3D"mailto:geda-user AT delorie DOT c=
om" target=3D"_blank" rel=3D"noreferrer">geda-user AT delorie DOT com</a>], &lt;<a=
 href=3D"mailto:geda-user AT delorie DOT com" target=3D"_blank" rel=3D"noreferrer"=
>geda-user AT delorie DOT com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x">
 =20

   =20
 =20
  <div>
    <p>Hi all,</p>
    <p>Every now and then, questions pop up about converting a logo or
      other image into a silk screen element, and many answers involve a
      more or less manual process using Inkscape combined with pstoedit.
      Also see the thread &#39;PCB jpg to silkscreen&#39; here, starting 7
      November 2019.<br>
    </p>
    <p>As I found I had to look up the details again every time, I
      decided to create a script by the name of pcbsilk that automates
      most of the process -- see attached file. It requires imagemagick,
      potrace and pstoedit to work, and accepts several common image
      formats (JPG, PNM as well as EPS).<br>
    </p>
    <p>How it works:<br>
    </p>
    <p>It first checks whether a width is specified for the resulting
      silk layer element. If no width is specified, it defaults to 40
      mm.</p>
    <p>Then it checks if the input file is an EPS file already; if not,
      it uses imagemagick&#39;s convert to convert the image to PBM format,
      which is then fed to potrace to create an EPS file. The resulting
      EPS file is then converted into a PCB silkscreen element using
      pstoedit.<br>
    </p>
    <p>But even though it works sort of OK, there are a few annoying
      things that I haven&#39;t been able to fix (apart from several smalle=
r
      refinements):</p>
    <p>- When specifying width in millimeters,=C2=A0 things work up to 73
      millimeters but throw a sort of overflow error above that value:</p>
    <blockquote>
      <p><span style=3D"font-family:monospace"><span style=3D"color:#000000=
;background-color:#ffffff">$ pcbsilk -W
            74mm testlogo.jpg =C2=A0</span><br>
          double free or corruption (!prev)
          <br>
          /home/richard/scripts/pcbsilk: line 36: 15520 Aborted
          =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 (memory dumped) pstoedit -q -f &quot;pcbfill&quot; -ssp
          $silkname.eps $silkname.pcb<br>
        </span></p>
    </blockquote>
    <p>The actual size itself does not seem to cause the problem, as
      inch sizes (e.g. -W 74in) work just fine. So it seems that it is
      the millimeter units that somehow have a limited range -- not in
      potrace (where the width is specified), but in pstoedit. I could
      of course work around the problem by converting millimeter sizes
      into inches before calling pstoedit, so I think that&#39;s what I&#39=
;ll
      do.<br>
    </p>
    <p>- Specifying a width of course also does not work for EPS files,
      as any scaling is done before conversion to EPS. Is there a way to
      specify width in pstoedit? Or is there an easy tool to scale an
      EPS element without having to parse the file myself?</p>
    <p>- The pstoedit command produces a PCB file with default workspace
      dimensions (6000 x 5000 mil here), with the silk image at the
      bottom left. Is it possible to (temporarily) adjust this default
      to fit the image size?<br>
    </p>
    <p>Thanks for comments, corrections and of course solutions!</p>
    <p>Best regards,</p>
    <p>Richard Rasker<br>
    </p>
  </div>

</blockquote></div>
</blockquote></div>

--0000000000006043360606b392df--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019