Image-based rock typing is carried out to quantitatively assess the heterogeneity of the reservoir specimen at a pore scale by classifying an image of a heterogeneous rock sample into a number of relatively homogeneous regions. Image-based rock typing can be treated as a special application of texture classification in the field of the digital core. In conventional texture classification algorithms, a single size window or a set of windows with different size are applied to scan the image to extract various local structure features, and then a classification algorithm is used to classify the image into different regions where each region possesses unique structure features. Due to the local features are extracted within a window, it is still challenging to identify the class of the voxels close to the boundary between different regions. In this paper, a rock typing method is proposed, which uses the geometry features of the grains instead of local structure features for classification. Inspired by the fact that in some cases the heterogeneity of the reservoir is mainly affected by the sedimentary process, which means each rock type always has certain specific grain features such as size and sphericity. To this kind of rock samples, the proposed grain-based rock typing algorithm can effectively address the boundary ambiguousness problem. In this study, the grains of the rock sample are partitioned firstly, and then their geometry features are calculated. Then a support vector machine algorithm is used to classify these grains into different rock types. Finally, the pore voxels are given a rock type, which is identical to its nearest grain. The proposed method shows excellent performance in the heterogeneous samples whose grains are available to be partitioned and distinguishable.