title: Most efficient way to detect non-transparent pixels in ImageMagick / RMagick
body: <p>I've got a series of drawings created via HTML Canvas. I need to create a heatmap using these drawings to show where the most common areas are.</p>
  <p>Each drawing is a PNG image with a transparent background. The only non-transparent pixels are those which the users has drawn on. Here are a couple sample images: <a href="https://imgur.com/a/saTK9d7" rel="nofollow noreferrer">https://imgur.com/a/saTK9d7</a></p>
  <p>I'm looking for the most efficient way to grab the non-transparent pixels for each image, which I will then add to a matrix to generate a heatmap.</p>
  <p>I can get this by iterating over each pixel and checking it's alpha value. However, these images are roughly 1400 x 750 pixels each, so that's ~1,000,000 of checks per image. This becomes untenable when we have hundreds of images to analyze on the fly.</p>
  <p>Is there any way to do this more efficiently? I'm open to all ideas.</p>