In this paper, a new in-line method was used to directly measure the gas solubility in polymer melts during foam extrusion. Metered quantities of polymer and specific gases were blended in a single screw extruder which is capable of producing polymeric foams of variable density. A specially designed optical window and flow restrictor valve placed between the die and the end of the extruder were used to generate dynamic solubility data by observing the onset of bubble formation/dissolution at the window through a microscope-CCD camera-monitor/recorder system. Solubility data were determined for systems involving nitrogen, argon and carbon dioxide in polystyrene and polyethylene terephthalate at different temperatures. Good agreement with literature data on the PS-CO2 system was obtained.