How can I get the number of custom post type posts that have a specific attachment image set?

I ended up figuring it out. I installed the wordpress plugin “Query Wrangler” which helped me build exactly what I was trying to figure out. What was the missing key was instead of the value being ” on the post where the custom field didn’t appear, I should have put ‘0’.

Here’s the final working code:

$args = array (
 'paged' => 1,
 'posts_per_page' => '-1',
 'offset' => 0,
 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit'),
 'ignore_sticky_posts' => 0,
 'orderby' => 'date',
 'order' => 'DESC',
 'post_type' => 'speakers',
 'meta_query' => array (
    0 => array (
      'key' => 'speaker_promo_image',
      'value' => '0',
      'compare' => '!=',
      'type' => 'CHAR',
    ),
  ),
  'meta_key' => 'speaker_promo_image',
);