How to use MNIST dataset?

I have Office-31 amazon datasets like this.

amazon/images/bike/bike jpgs here...
             /keyboard/keyboard jpgs here...
             /trash_can/trash_can jpgs here...

I can use these data with

data_transforms = {
        transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])

dsets = datasets.ImageFolder(root=data_dir + source_set + '/images', transform=data_transforms)
dset_loaders = {x:, batch_size=int(BATCH_SIZE / 2), shuffle=True)

and now I want to use MNIST dataset in pytorch.
I know how to load MNIST using datasets.MNIST and DataLoader
but I don’t know how to load in this way. because I don’t have jpg files like amazon data.
Is there any way to download MNIST in jpgs with different folder name according to the class?
How can I load MNIST like amazon dataset? provides MNIST as .png files, maybe this helps?