To understand how the recovery factor decreases in porous media through the trapping of hydrocarbons, it is necessary to be able to predict the capillary pressure in pore-scale networks. The capillary pressure is determined by the shape of the fluid interfaces, which strongly depends on the wettability of the pore walls and on the pore structure itself. We use the Surface Evolver to simulate the shapes of fluid interfaces when gas enters a one end of a channel, representing a model porous medium, containing a liquid phase (oil). We determine the shape of the interface between the two fluids (oil and gas) to give accurate measurements of the capillary pressure pc in porous media. By making small changes in the fluid volumes, we predict in a quasi-static manner the variation of capillary pressure during the process of oil mobilization by gas invasion. We consider a channel with an equilateral triangular and rectangular cross-section. Increasing the contact angle (θ) at which the wetting fluid (oil phase) meets the walls causes the capillary pressure to decrease until it reaches zero at a critical contact angle. The capillary pressure increases as the liquid phase is removed.