How to get 4 images with their dimensions and visualize them

I have a train_loader containing 100 datasets and a test_loader with 20 data. I need to iterate over the train_loader and test_loader and get 4 images from each and visualize them with their respective resolution. Can someone help please?