Upscaling (enlarging) images is very hard to do. Of course, enlarging an image with dimensions 1024x768 to 1280x1024 is not that hard, especially when the ratio remains the same. However, when upscaling to bigger
The compression level of the JPG image format is a huge factor in the upscaling capability of an image. Compression normally means: how can I get rid of as much image data as possible, without affecting the image (too much).
After compression (of any image format, really) the upscaling capability diminishes significantly. Myself, I tend to use the following rule of thumb: if you have a JPG image with 80% compression (a very common, if not the default level of compression) you can more or less safely upscale up to 20% of the original size (about 25% of the compression level value), but only if the ratio remains the same. For example: 1024x768 (original) + 20% would become 1280x1024.
After that, don't bother. Years ago, around 1998-2000, I did buy a piece of software (for about 150 of today Euros) that could significantly upscale images successfully. The floppy it came on wasted away and as far as I know this software isn't on the consumer market anymore. The guy who made it was always busy making computer demos (in Assembly) in his free time, while studying mathematics in University. He finished his study with a project where someone would make a random pile of coins from different countries and his software could tell you the exact amount of coins from a satellite image.
Recalculating the correct missing image information from any image is very hard to do and will always lead to artifacts. Nothing substitutes uncompressed image data. Still, all bets are off when the image ratio changes during upscaling, even if the image is uncompressed. Not all of the tricks that work when upscaling (compressed) movies, work as well for stationary images I'm afraid.