We have developed a model to explain the phenomena of electron focusing by pyroelectric and photogalvanic crystals. The pyroelectric crystals used to compare experiments with theory were Fe doped and un-doped LiNb03. The crystals were either heated from the +z end or illuminated with a laser (to test photogalvanic effect). Heating the crystals by passing a current through a resistor attached to the +z end produced the pyroelectric effect: a change in polarization in response to a change in temperature. Illuminated with a CW solid-state diode pumped laser (532 nm, 100 mW) produces the photogalvanic effect: the build up of charge on the polar surfaces of the crystal. In both cases the polar ends of the crystal becomes electrically charged and produced self-focusing electron beams that were imaged on a ZnS screen. Using different targets we have produced x-rays, and demonstrated x-ray imaging of metal masks.