works for rgb images now