Ok I generated a ASCII PBM File logo.pbm
I created the plain text file convert.awk 
installed gawk
then ran it to create the output file the > selects the output.

awk -f convert.awk logo.pbm > art.out

I created logo.mod in kicad

I Edited Logo.mod by adding the text in art.out before $EndMODULE 

But when I loaded a small pic of a smilie in it only shown the upper half of 
it. maby some other part.

25 pix by 25 pix.

Thanks so far it looks realy cool and thanks for writing the program. 

--- In [email protected], "raoulduke_esq" <raoulduke_...@...> wrote:
>
> Pardon me if I am just being obtuse, but I could find no easy way to add an 
> image or artwork to a layout.  I've tried pstoedit but that utility (in 
> addition to being broken if you are in a directory path that has a space in 
> it) only works for text.
> 
> Because I am under the gun, I had to gin up something to get a project out 
> the door.  So I came up with a quick and dirty solution.
> 
> 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".
> 
> 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.
> 
> I hope this makes sense and helps someone other than me.  And I hope that I 
> have not reinvented the wheel.  I'm sorry that I use awk as a script language 
> of choice, I suppose I could clean it up as a Perl script if there is any 
> interest.
> 
> raoul
> 
> 
> ----------Cut Here----------
> # 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 );
>                 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; }}
> ----------Cut Here----------
>


Reply via email to