Accurate detection and analysis of bubble size and shape in bubbly flow are critical to understanding mass and heat transfer processes. Convolutional neural networks have limitations in different bubble images due to their dependence on large amounts of labeled data. A new foundational Segment Anything Model (SAM) recently attracts lots of attention for its zero-shot segmentation performance. Herein, we developed a novel image processing method named bubSAM, which achieves efficient and accurate bubble segmentation and shape reconstruction based on SAM. The segmentation performance of bubSAM is 30% higher than that of SAM, and its accuracy reaches 90% under different bubbly flow conditions. The accuracy of bubble shape reconstruction algorithm (BSR) in bubSAM is about 30% higher than that of typical ellipse fitting method, thus better restoring the geometric shape of bubbles. BubSAM can provide great support for understanding gas-liquid multiphase flow and design of industrial multiphase reactors.