This is an interesting question overall. What happens if you embed an encrypted message in X file-image format and then change that format? Well, it gets destroyed.
The trick here is that all the image-format converters only take into consideration the various specifications that make up visible pixels.
So when you encipher your message & embed it in your image with your steganography application, it is THAT application that makes sure that the image still makes sense afterwards (both visually & that the encrypted data is still valid). It is also that application that knows WHERE to look for that encrypted data in order to decrypt them.
A way to do this is for your steganographic process to follow the JPEG specification and analyse an image according to its weight and foresee what will be discarded in the 8x8 blocks and make sure to avoid the small weight spots to embed data. Truth is though that JPEG compression is not an exact science and makes alot of assumptions and approximations making it hard for us to predict something like that.
But it's all 0&1's in the end so there must be something we can do. Yes, you could develop a complex enough algorithm that is so abstract that where the encrypted message is doesn't really matter right? Not exactly, you still need to play inside a quite limited system without breaking the various image standards or whatever standard it is that you're working with since you're embedding concealed data and are not looking to alter the original content.
You should also know that the maths you're going to need will be quite involved. Have a look at pattern theories, statistics and probability. Have a look at Markov's process and Continuous-time Markov chains.
Also this: http://www.dam.brown.edu/ptg/REPORTS/02-10.pdf
To give you an idea of how deep this matter of being able to predict randomly mangled data in an undefined system can get.
"I hope for nothing. I fear nothing. I am free." ~ Nikos Kazantzakis