code: def _get_individual_image(self, run, tag, index, sample):
      
      if self._db_connection_provider:
        db = self._db_connection_provider()
        cursor = db.execute(
            '''
            SELECT data
            FROM TensorStrings
            WHERE
              /* Skip first 2 elements which are width and height. */
              idx = 2 + :sample
              AND tensor_rowid = (
                SELECT rowid
                FROM Tensors
                WHERE
                  series = (
                     SELECT tag_id
                     FROM Runs
                     CROSS JOIN Tags USING (run_id)
                     WHERE
                       Runs.run_name = :run
                       AND Tags.tag_name = :tag)
                  AND step IS NOT NULL
                  AND dtype = :dtype
                  /* Should be n-vector, n >= 3: [width, height, samples...] */
                  AND (NOT INSTR(shape, ',') AND CAST (shape AS INT) >= 3)
                ORDER BY step
                LIMIT 1
                OFFSET :index)
            ''',
            {'run': run,
             'tag': tag,
             'sample': sample,
             'index': index,
             'dtype': tf.string.as_datatype_enum})
        (data,) = cursor.fetchone()
        return six.binary_type(data)
  
      events = self._filter_by_sample(self._multiplexer.Tensors(run, tag), sample)
      images = events[index].tensor_proto.string_val[2:]  # skip width, height
      return images[sample]
docs: Returns the actual image bytes for a given image.
  
      Args:
        run: The name of the run the image belongs to.
        tag: The name of the tag the images belongs to.
        index: The index of the image in the current reservoir.
        sample: The zero-indexed sample of the image to retrieve (for example,
          setting `sample` to `2` will fetch the third image sample at `step`).
  
      Returns:
        A bytestring of the raw image bytes.