raoulduke_esq posted an AWK script a while back which works with ASCII 
PBMs.   I run this using cygwin and I've found it works well enough.   I 
don't have time to search for it in the group posts, so here it is:

# This script will take an ASCII PBM B&W file and convert it to a series
# of "DS" (Draw Segment) statements in PCBNEW syntax.  The deltaX and deltaY
# is defined in "step" which is in uints of 1/10 mil.  The layer is 
currently
# set to 21, the component layer silkscreen.  Swap bg & fg based on whether
# black or white is the foreground.
#
# State 0 : look for magic number - must be P1 (can be P4 for raw file)
# State 1 : look for height & width
# State 2 : process data
# State 3 : done with data - skip the rest
#
BEGIN { state = 0; step = 40; layer = 21; fg = "1"; bg = "0"; }
{if (NR == 1) {
         state = 1;
         if ($1 != "P1") {
             printf("Must supply an ASCII PBM image file\n");
             exit 1
         }
         next;
     }
}
/^#/    { next }  # Comment line, skip it
{if (state == 1) {
         width = $1;
         height = $2;
         buff = "";
         state = 2;
         Y = - ((step * height) / 2);
         initX = - ((step * width) / 2);
         next;
     }
}
{if (state == 2)  {
         buff = buff $1;
         if (length( buff ) >= width) {
             scanline = substr( buff, 1, width );
             buff = substr( buff, width + 1 );
             Y += step;
             X = initX;
             while ( Z1 = index( scanline, fg )) {
                 scanline = substr( scanline, Z1 );
                 Z2 = index( scanline, bg );
                 if (Z2 == 0)
                     Z2 = length( scanline ) + 1;
                 scanline = substr( scanline, Z2 );
                 Z1 = step * Z1 + X;
                 Z2 = step * Z2 + Z1 - 2 * step;
                 X = Z2;
                 printf( "DS %d %d %d %d %d %d\n", Z1, Y, Z2, Y, step, 
layer );
             }
             height--;
             if (height == 0)
                 state = 3;
         }
     }
}
{if (state == 3) { nextfile; }}

Instructions:

Step 1: Generate an ASCII PBM file - I use GIMP.  A monochrome (black 
and white) image will be represented by a file full of "0" and "1". Call 
it something like "art.pbm".

Step 2: Run the ASCII PBM file "art.pbm" through the following awk 
script and put the output into a file, call it "art.out":

         awk -f ConvertPBM.awk pic.pbm > art.out

Step 3: Create a module library with a single component, call it 
something like "Logo".  The library will be called "Logo.mod".

Step 4: Edit the module library "Logo.mod", look for the $EndMODULE 
line, and copy the contents of "art.out" immediately before it.  Save 
the file.

Step 5: Edit the module library and move things around, add the module 
name, etc.

Step 6: In PCBnew, add the module from the library and place it where 
you want.

Regards,

Robert.

On 19/05/2010 15:49, ferraro.giuse...@ymail.com wrote:
> It seems that this program doesn't run correctly.
> When I try to convert an image JPG to BRD KICAD file, I have an error message:
>
> Traceback (most recent call last):
>    File 
> "C:\apps\pyinstaller-1.3\TTConv0.2\buildTTConv0.2\out1.pyz/Wx_Image2Kicad
> ", line 147, in OnSelBrdOut
>    File 
> "C:\apps\pyinstaller-1.3\TTConv0.2\buildTTConv0.2\out1.pyz/wx._windows",
> line 711, in ShowModal
> wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at 
> ..\..\src\c
> ommon\filefn.cpp(1746) in wxParseCommonDialogsFilter(): missing '|' in the 
> wildc
> ard string!
>
> I have installed pyton 3.1.1.
> Can You tell me something?
> regards
> G
>
> --- In kicad-users@yahoogroups.com, Andy Eskelson<andyya...@...>  wrote:
>>
>> Have a look at TTConv in the group files.
>>
>> The one dated feb 8th looks to be the latest.
>>
>> One of it's functions is to import images, which may be what you want.
>>
>> If I remember correctly is intended to import things like logos rather
>> than images as such.
>>
>> Andy
>>
>>
>>
>>
>> On Wed, 19 May 2010 11:51:46 -0000
>> "ferraro.giuse...@..."<ferraro.giuse...@...>  wrote:
>>
>>> Hi,
>>> I'm trying to insert an image in PCB. How can I do?
>>> I'm using WINDOWS VERSION, last version.
>>> Bye
>>> G
>>>
>>>
>>>
>>>
>>> ------------------------------------
>>>
>>> Please read the Kicad FAQ in the group files section before posting your 
>>> question.
>>> Please post your bug reports here. They will be picked up by the creator of 
>>> Kicad.
>>> Please visit http://www.kicadlib.org for details of how to contribute your 
>>> symbols/modules to the kicad library.
>>> For building Kicad from source and other development questions visit the 
>>> kicad-devel group at http://groups.yahoo.com/group/kicad-develYahoo! Groups 
>>> Links
>>>
>>>
>>>
>>
>
>
>
>
> ------------------------------------
>
> Please read the Kicad FAQ in the group files section before posting your 
> question.
> Please post your bug reports here. They will be picked up by the creator of 
> Kicad.
> Please visit http://www.kicadlib.org for details of how to contribute your 
> symbols/modules to the kicad library.
> For building Kicad from source and other development questions visit the 
> kicad-devel group at http://groups.yahoo.com/group/kicad-develYahoo! Groups 
> Links
>
>
>
>
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.819 / Virus Database: 271.1.1/2883 - Release Date: 05/19/10 
> 07:26:00
>
No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 9.0.819 / Virus Database: 271.1.1/2883 - Release Date: 05/19/10 
07:26:00

Reply via email to