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> In-Reply-To: From: "Erich Heinzle (a1039181 AT gmail DOT com) [via geda-user AT delorie DOT com]" Date: Mon, 2 Oct 2023 14:12:53 +1030 Message-ID: Subject: Re: [geda-user] PCB silk layer image script To: geda-user Content-Type: multipart/alternative; boundary="0000000000006043360606b392df" 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, 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], 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
Two more things

There is a fourth option, also allowing conversion of vector graphics t= o pcb layout artwork, namely, the pstoedit utility.
=
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.

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.
<= br style=3D"font-size:12.8px">echo 'au= tocrop; save' | pcb-rnd --gui batch input.rp

This will work on any object on any = layer.

Regards,

Erich

On Mon, 2 Oct 2023 1= 1:52 Erich Heinzle, <a1039181 AT gmai= l.com> wrote:
I have three approaches to pcb artwork

The simplest is image2footprint, which works well for bitmap g= raphics


The catch is, gEDA PCB does not have a distin= ct soldermask layer that is editable, limiting the full range of effects po= ssible.

There are better= alternatives for pcb-rnd, including the parametric bitmap() footprint whic= h can be launched from the footprint library window
=

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=


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>


Regards,
Erich




On Sun, 1 Oct 2023 23:50 Richa= rd Rasker (rasker AT linetec DOT nl) [via geda-user AT delorie DOT com], <geda-user AT delorie DOT com> wrote:
=20 =20 =20

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 smalle= r refinements):

- When specifying width in millimeters,=C2=A0 things work up to 73 millimeters but throw a sort of overflow error above that value:

$ pcbsilk -W 74mm testlogo.jpg =C2=A0
double free or corruption (!prev)
/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 "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--