Basic rock mechanical parameters, that is, the uniaxial compressive strength σ c and elastic modulus E, have close relationships with the fractal dimension and inhomogeneity. Scanning electronic microscopy and fractal dimension calculations are applied to four different rock types (mudstone, sandstone, limestone, and basalt) in order to investigate the relationships between the rock mechanical properties, fractal dimensions, and homogeneity. The results show that the fractal dimension of each rock type fluctuates as the scanning electronic microscopy magnification increases. Rocks with different uniaxial compressive strength and elastic modulus values possess different self-similarity properties, and when the uniaxial compressive strength or elastic modulus increases, the fractal dimension of the rock microstructure decreases. The rock homogeneity is consistent with the fractal dimension, that is, the higher the homogeneity is, the larger the fractal dimension. Generally, homogeneity refers to the macroscale, and fractal dimension refers to the microscale. Overall, this research provides an innovative and effective approach for researching the mechanical behavior of rocks through a combination of uniaxial compression tests, homogeneity, and fractal dimensions.