Grain-size distributions are a key geomorphic metric of gravel-bed rivers. Traditional measurement methods include manual counting or photo sieving, but these are achievable only at the 1-10 m(2) scale. With the advent of drones and increasingly high-resolution cameras, we can now generate orthoimagery over hectares at millimeter to centimeter resolution. These scales, along with the complexity of high-mountain rivers, necessitate different approaches for photo sieving. As opposed to other image segmentation methods that use a watershed approach, our open-source algorithm, PebbleCounts, relies on k-means clustering in the spatial and spectral domain and rapid manual selection of well-delineated grains. This improves grain-size estimates for complex riverbed imagery, without post-processing. We also develop a fully automated method, PebbleCountsAuto, that relies on edge detection and filtering suspect grains, without the k-means clustering or manual selection steps. The algorithms are tested in controlled indoor conditions on three arrays of pebbles and then applied to 12 x 1m(2) orthomosaic clips of high-energy mountain rivers collected with a camera-on-mast setup (akin to a low-flying drone). A 20-pixel b-axis length lower truncation is necessary for attaining accurate grain-size distributions. For the k-means PebbleCounts approach, average percentile bias and precision are 0.03 and 0.09, respectively, for similar to 1.16 mm pixel(-1) images, and 0.07 and 0.05 psi for one 0.32 mm pixel(-1) image. The automatic approach has higher bias and precision of 0.13 and 0.15 psi, respectively, for similar to 1.16 mm pixel(-1) images, but similar values of 0.06 and 0.05 for one 0.32 mm pixel(-1) image. For the automatic approach, only at best 70% of the grains are correct identifications, and typically around 50 %. PebbleCounts operates most effectively at the 1 m(2) patch scale, where it can be applied in similar to 5-10 min on many patches to acquire accurate grain-size data over 10-100 m(2) areas. These data can be used to validate PebbleCountsAuto, which may be applied at the scale of entire survey sites (10(2)-10(4) m(2)). We synthesize results and recommend best practices for image collection, orthomosaic generation, and grain-size measurement using both algorithms.