import dmc2gym
from PIL import Image

env = dmc2gym.make(domain_name='hopper', task_name= 'hop', seed=1, from_pixels=True, height=480, width=480, frame_skip=1, visualize_reward=False)

done = False
obs = env.reset()
while not done:
  action = env.action_space.sample()
  print(action)
  obs, reward, done, info = env.step(action)
  print(reward)

  # save the inage 
  obs = obs.transpose(1, 2, 0)
  image = Image.fromarray(obs)

# Save the image
  image.save('img.png')


