We investigate the physical foaming process of glassy poly(ether imide) and poly(ether sulfone) using carbon dioxide and report temperature-concentration diagrams ("foam diagrams") marking out the foaming envelope in which dense CO2-saturated films expand and microvoids are introduced. Two types of porosities are observed. Closed microcellular structures occur at carbon dioxide saturation levels below 50 cm3 (STP)/cm3 (polymer); nanoporous bicontinuous (open) structures with pore sizes as small as 40 nm occur above this CO2 concentration threshold, which is identical for both polymers. The cellular-to-bicontinuous transition is characterized in detail on the basis of gas permeation measurements and is represented as a separate window inside the foaming diagram. In this paper, the transition to bicontinuous structures is reported for the first time, and its generic physical basis is critically reviewed.