I want to reduce the size an image in order to get it to fit on a online program I'm using for an experiment. However, the issue with this is that it reduces the file size, which I need to stay the same. Is there a way of editing the image size of a photo without reducing the file size or the resolution?
There is no way to do that.
If you have an uncompressed file format the file size will reduce depending on the pixel dimensions.
If you have a compressed format it is really complicated trying to guess the file size, because this depends on the content of the image, the algorithm, the compression settings, and also the pixel dimension.
The only way is having different images, randomly choosing two that have a 2Mb file size.
On your comments, you are adding more and more terms that has nothing to do with file size:
I want to keep the resolution quality and file size the same.
There is no such "resolution quality" Quality is a process, and each file can have an assigned resolution and have a good quality for the intended objective. You can have a good quality wallpaper for a 4k monitor and having a good quality one for an HD screen, or even have a good quality thumbnail. All of them being different sizes (for now, resolution).
Besides that file size is about DATA and how it is arranged and packed. You can have a very bad photo of 10Mb and a masterpiece on 2Mb. All it counts to the file size is the data (pixels) and how they are arranged (compression).