An optically pumped pulsed terahertz laser is presented. The pump laser is a line-tunable TEA CO2 laser. The terahertz cavity consists of a 2 m-long quartz glass tube, a GaAs input coupler and a SiO2 output coupler, and is filled with ammonia gas as terahertz active medium. Intense terahertz radiation is emitted at different wavelengths from the terahertz laser. The terahertz wavelengths are measured by a Fabry-Perot interferometer which is composed of two metal grids. As high as 204 mJ pulse energy is obtained at 151.5 μm wavelength when the cavity is pumped by a 32 J CO2 laser. The terahertz laser is applied in transmission imaging, and some preliminary imaging results are presented.