Discussion:
[Gerbv-devel] Bounty to update handling of layers on image export from command line
ian
2016-03-14 08:07:55 UTC
Permalink
Hello,

Gerbv is great, thanks for all your work on it. This is a bountied
request for a command line feature that exports images aligned and
centered based on all layers, but allows some layers to be disabled (not
rendered) and used for alignment only. Alternately it could load all
layers at once and export individual images.

There's a couple open source scripts that use gerbv to render PCBs.
Gerblook is a python script at github. I also have a nasty PHP version
in our dangerousprototypes github that we use at dirtypcbs.com. Both of
these scripts have a workaround to deal with gerbv's image exports that
is really taxing on the server.

The problem is that when you select only one layer for export, gerbv
sizes and centers the exported image around only that layer. We need to
export each layer and then composite them into an image. On many many
gerbers there is silk, outlines, etc that are not the same size on each
layer. If we just export each layer the images do not align when we make
the composite.

Our workaround is to render all layers in each image exported, with one
layer set to color and all others set to alpha transparency. This is
effective, but it is increasingly common to have extremely complex
silkscreens that take 60+ seconds to render. Since the silk is enabled
for each image exported (but transparent), we're seeing 800+ second
rendering times on a really power server for many gerbers we process.

What would simplify our work flow is to have a mode/feature that
specifies layers to be used for alignment and centering only without
rendering them.

I profess ignorance if this is actually possible. It is not clear to me
if the import and rendering processes are separated enough to actually
see a speed increase. If the compute intensive part is rendering lots of
alpha layers during image export then the ability to include but not
render layers would help a lot. If the processing time is mostly in
loading the layers on each pass then it would be better to have a
feature that loads all the layers from one shell command and export an
image of each based on the complete set.

I don't want to set a specific bounty because I understand there may be
several factors that make this more difficult. I'd offer at least $500,
more if anyone wants to discuss it at a more detailed level.

Thank you and best regards,

Ian
James Sleeman
2016-03-14 11:27:42 UTC
Permalink
Ian, if I'm reading you right, what you want is to produce 2 images - a
top view and a bottom view, each view showing the combination of board,
copper, mask, silk and holes from bottom up in that order.

Like this for example (bottom layer, mirrored, of course you can
de-mirror it post-process).

http://imgur.com/2PWuexd

If that's the ticket, what you need to do then is to invert the mask
layer so it's foreground is the mask "ink" itself (in order that an
alpha can be set on it) and then use them all at once, luckily inverting
a gerber is easy it seems, just stick "%IPNEG*% at the top (and probably
remove any %IPPOS*% commands already in it). At least it works for my
gerber generated from DipTrace

Here's a quick hack job bash script to do the job, I used this script to
generate the image above...

https://gist.github.com/sleemanj/c0db735afe029c3a478b

Usage:

dirtyimager.sh Through.txt TopSilk.gto TopMask.gts Top.gtl

filenames are obvious I hope, output gets dumped in /tmp/dirtyoutput.png


Fiddle with colours in the script to your desire :-)
James Sleeman
2016-03-14 11:57:19 UTC
Permalink
Post by James Sleeman
Like this for example (bottom layer, mirrored, of course you can
de-mirror it post-process).
http://imgur.com/2PWuexd
dirtyimager.sh Through.txt TopSilk.gto TopMask.gts Top.gtl
Whoops that's the top view, for completeness, here's the (mirrored)
bottom view generated by the same script...

http://imgur.com/HDV6yVt

dirtyimager.sh Through.txt BottomSilk.gbo BottomMask.gbs Bottom.gbl
ian
2016-03-26 07:37:23 UTC
Permalink
Hi James,

Thank you for responding to my email. I'm sorry for the delayed reply, I
have been out of the office and then we had hacker camp.

The output directly from gerbv is ok, but I think our approach to
blending the layers creates a more life-like look. Here is an example.

First we output each layer from gerbv. One layer is on, the others are
alpha transparent:
Loading Image...
Loading Image...
Loading Image...
Loading Image...
Loading Image...

The using the open source ImageMagik image tools, we start to composite
the layers of the board
Loading Image...

And then add color fill:
Loading Image...

Then create the top and bottom backgrounds with drill holes:
Loading Image...
Loading Image...

Top and bottom solder masks:
Loading Image...
Loading Image...

Then the layers are stacked: _soldermask, _copper, _background for the
final view:
Loading Image...
Loading Image...

In my php script I go a bit further and add a final _copper on the top
faded very light to give the impression of where the traces are.
Gerblook doesn't do this, but it handles other things much better, so we
are using gerblook on the new site.

When I wrote my initial rendering script I tried for a while to get
direct output from gerbv similar to this, but ended up ground the same
way as gerblook. If there is an alternative using only gerbv I would
happily adopt it.

The feature I'd like to see (and would happily pay for) is a way to get
the first five files with fewer processing cycles expended.

Thank you and best regards,

Ian
Post by James Sleeman
Post by James Sleeman
Like this for example (bottom layer, mirrored, of course you can
de-mirror it post-process).
http://imgur.com/2PWuexd
dirtyimager.sh Through.txt TopSilk.gto TopMask.gts Top.gtl
Whoops that's the top view, for completeness, here's the (mirrored)
bottom view generated by the same script...
http://imgur.com/HDV6yVt
dirtyimager.sh Through.txt BottomSilk.gbo BottomMask.gbs Bottom.gbl
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Gerbv-devel mailing list
https://lists.sourceforge.net/lists/listinfo/gerbv-devel
Linda Huxley
2016-03-26 12:36:12 UTC
Permalink
Hi Ian,

We are able to generate very high quality renderings right in Gerbv,
without any scripts, other than what is provided by the Gerbv project
files. See the attached screen print, gerbv.png.

In our case, we've made the solder mask overly transparent, so that we
can see both copper layers. It shouldn't be difficult to tweak the
color and transparency to obtain the standard Dangerous Prototypes board
colors.

Regards,

Linda
Post by ian
Hi James,
Thank you for responding to my email. I'm sorry for the delayed reply, I
have been out of the office and then we had hacker camp.
The output directly from gerbv is ok, but I think our approach to
blending the layers creates a more life-like look. Here is an example.
First we output each layer from gerbv. One layer is on, the others are
http://dirtypcbs.com/videos/top_silkscreen.png
http://dirtypcbs.com/videos/top_copper.png
http://dirtypcbs.com/videos/plated_drills.png
http://dirtypcbs.com/videos/bottom_copper.png
http://dirtypcbs.com/videos/bottom_silkscreen.png
The using the open source ImageMagik image tools, we start to composite
the layers of the board
http://dirtypcbs.com/videos/background_initial.png
http://dirtypcbs.com/videos/background.png
http://dirtypcbs.com/videos/top_background.png
http://dirtypcbs.com/videos/bottom_background.png
http://dirtypcbs.com/videos/top_soldermask.png
http://dirtypcbs.com/videos/bottom_soldermask.png
Then the layers are stacked: _soldermask, _copper, _background for the
http://dirtypcbs.com/videos/top.png
http://dirtypcbs.com/videos/bottom.png
In my php script I go a bit further and add a final _copper on the top
faded very light to give the impression of where the traces are.
Gerblook doesn't do this, but it handles other things much better, so we
are using gerblook on the new site.
When I wrote my initial rendering script I tried for a while to get
direct output from gerbv similar to this, but ended up ground the same
way as gerblook. If there is an alternative using only gerbv I would
happily adopt it.
The feature I'd like to see (and would happily pay for) is a way to get
the first five files with fewer processing cycles expended.
Thank you and best regards,
Ian
Post by James Sleeman
Post by James Sleeman
Like this for example (bottom layer, mirrored, of course you can
de-mirror it post-process).
http://imgur.com/2PWuexd
dirtyimager.sh Through.txt TopSilk.gto TopMask.gts Top.gtl
Whoops that's the top view, for completeness, here's the (mirrored)
bottom view generated by the same script...
http://imgur.com/HDV6yVt
dirtyimager.sh Through.txt BottomSilk.gbo BottomMask.gbs Bottom.gbl
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Gerbv-devel mailing list
https://lists.sourceforge.net/lists/listinfo/gerbv-devel
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Gerbv-devel mailing list
https://lists.sourceforge.net/lists/listinfo/gerbv-devel
Ian
2016-03-28 08:05:28 UTC
Permalink
Wow, that's great. I will try that now. We get a lot of value from gerbv. Can I make a donation to the developers?

Thank you and best regards,

Ian

Sent from a mobile device, please excuse my brevity.
Post by Linda Huxley
Hi Ian,
We are able to generate very high quality renderings right in Gerbv,
without any scripts, other than what is provided by the Gerbv project
files. See the attached screen print, gerbv.png.
In our case, we've made the solder mask overly transparent, so that we
can see both copper layers. It shouldn't be difficult to tweak the
color and transparency to obtain the standard Dangerous Prototypes board
colors.
Regards,
Linda
Post by ian
Hi James,
Thank you for responding to my email. I'm sorry for the delayed
reply, I
Post by ian
have been out of the office and then we had hacker camp.
The output directly from gerbv is ok, but I think our approach to
blending the layers creates a more life-like look. Here is an
example.
Post by ian
First we output each layer from gerbv. One layer is on, the others
are
Post by ian
http://dirtypcbs.com/videos/top_silkscreen.png
http://dirtypcbs.com/videos/top_copper.png
http://dirtypcbs.com/videos/plated_drills.png
http://dirtypcbs.com/videos/bottom_copper.png
http://dirtypcbs.com/videos/bottom_silkscreen.png
The using the open source ImageMagik image tools, we start to
composite
Post by ian
the layers of the board
http://dirtypcbs.com/videos/background_initial.png
http://dirtypcbs.com/videos/background.png
http://dirtypcbs.com/videos/top_background.png
http://dirtypcbs.com/videos/bottom_background.png
http://dirtypcbs.com/videos/top_soldermask.png
http://dirtypcbs.com/videos/bottom_soldermask.png
Then the layers are stacked: _soldermask, _copper, _background for
the
Post by ian
http://dirtypcbs.com/videos/top.png
http://dirtypcbs.com/videos/bottom.png
In my php script I go a bit further and add a final _copper on the
top
Post by ian
faded very light to give the impression of where the traces are.
Gerblook doesn't do this, but it handles other things much better, so
we
Post by ian
are using gerblook on the new site.
When I wrote my initial rendering script I tried for a while to get
direct output from gerbv similar to this, but ended up ground the
same
Post by ian
way as gerblook. If there is an alternative using only gerbv I would
happily adopt it.
The feature I'd like to see (and would happily pay for) is a way to
get
Post by ian
the first five files with fewer processing cycles expended.
Thank you and best regards,
Ian
Post by James Sleeman
Post by James Sleeman
Like this for example (bottom layer, mirrored, of course you can
de-mirror it post-process).
http://imgur.com/2PWuexd
dirtyimager.sh Through.txt TopSilk.gto TopMask.gts Top.gtl
Whoops that's the top view, for completeness, here's the (mirrored)
bottom view generated by the same script...
http://imgur.com/HDV6yVt
dirtyimager.sh Through.txt BottomSilk.gbo BottomMask.gbs Bottom.gbl
------------------------------------------------------------------------------
Post by ian
Post by James Sleeman
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Gerbv-devel mailing list
https://lists.sourceforge.net/lists/listinfo/gerbv-devel
------------------------------------------------------------------------------
Post by ian
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Gerbv-devel mailing list
https://lists.sourceforge.net/lists/listinfo/gerbv-devel
------------------------------------------------------------------------
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
------------------------------------------------------------------------
_______________________________________________
Gerbv-devel mailing list
https://lists.sourceforge.net/lists/listinfo/gerbv-devel
Loading...