5
\$\begingroup\$

Gerbv (open-source Gerber viewer) has the neat ability to export a customizable rendition of a given layer-stackup, to an output PNG.

Here is the manual (Ctrl+F for "export"): http://manpages.ubuntu.com/manpages/trusty/man1/gerbv.1.html

But no matter what I try, I'm unable to come up with any way to do that export such that only the area within the board outline, is exported to the PNG.

Currently the exported PNG will show a full rectangular area (along with a set border area outside the board outline) even if the board outline is, say, a circular one.

So, is there any suggested workaround to achieve the image of just the exact board shape itself?

Or, alternatively, is there a way to assign a specific different color ONLY to the "external background" area (i.e., the excess area around the actual board outline itself) such that it is different from all colors of the area inside the board outline?


NOTE 1:

For clarification, assume I'm starting with all standard Gerber layers including an outline layer.


NOTE 2:

Here are a few things I have tried so far:

1) Standard export: GUI approach: Load all layers. File > Export > Commandline approach: gerbv --dpi=600 --border=0 --export=png --output=fullBoard.png --project= myProject.gvp

2) Set window size for the export: --window = <300,300> This is only altering the rectangular window size (obviously it has no dependence on the actual outline layer of the board).

3) Image processing using GIMP (subtracting a representative color from the board background, i.e., the area outside the outline, and then performing a crop). Still trying, but so far, I am unable to come up with any universally working criteria for programmatically identifying JUST the area outside the board outline (represented by GKO).

\$\endgroup\$
  • \$\begingroup\$ can you elaborate more on what you have already tried? \$\endgroup\$ – Funkyguy Jul 24 '14 at 20:25
  • \$\begingroup\$ "is there any suggested workaround to achieve the image of just the exact board shape itself" - As far as I know, there is no raster graphics file format that stores anything other than a rectangular array of pixels. But I probably just don't get what exactly you want to achieve. Why don't you just export the image as it is and use your favorite picture editor to flood the surroundings? Mind to show an export example and illustrate what should be different? \$\endgroup\$ – Rev1.0 Jul 24 '14 at 20:30
  • \$\begingroup\$ Since it's an open source project, you may either ask the contributors this question, or modify the source code by yourself (if you have the skills for). \$\endgroup\$ – RawBean Jul 24 '14 at 20:34
  • \$\begingroup\$ All: I'm adding details about things I have tried as well as some images; please check in a few minutes again. \$\endgroup\$ – boardbite Jul 24 '14 at 20:45
  • \$\begingroup\$ @Rev1.0: I think what you are suggesting is along the lines of what I want; flooding/subtracting the surroundings programmatically would be OK for me, except how would I choose exactly that area? By the way, PNG format is capable of non-rectangular graphics (i.e., for example a circular image with a transparent/non-existent background); it's just that GerbV's export is including the background as part of the image. \$\endgroup\$ – boardbite Jul 24 '14 at 21:17
8
+250
\$\begingroup\$

Since image processing using GIMP is an option for you, I am posting this as an answer.

From the comments:

PNG format is capable of non-rectangular graphics (i.e., for example a circular image with a transparent/non-existent background)

This is not exactly true. PNG supports only rectangular graphics. There is no non-existing background concept. PNG uses alpha-transparency, which essentially allows to set the transparency for each pixel.

"flooding/subtracting the surroundings programmatically would be OK for me, except how would I choose exactly that area?"

Using GIMP, its easy to get this result in a matter of seconds.

  1. To select the area around the PCB border you want to make transparent, I used the Magic Wand / Fuzzy selection tool. Go to "Tools" > "Selection Tools" > "Fuzzy Selection" (keyboard shortcut "U"). Then click on the respective area. Use the "Threshold" setting to set the range of color variations that are included in the selection.

  2. In the Layer window, select Layer - Transparency - Add Alpha Channel. If this is blanked out then your image is already set to store transparency data.

  3. Select Edit - Clear. This makes the previous selection transparent.

  4. When you save the file, make sure `Save colour values from transparent pixels' is selected.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.