A stuck violin peg can be an annoying pain to deal with. No one wants to be done in this situation! Truth is, some people might be tempted to just throw out the violin or take it to a professional and have them look at it. While that may be the best option, there are a number of things you can try to the peg in order to move it and readjust it yourself. While I do not guarantee any of this will work 100 percent of the time, they are safe and will not damage the instrument so long as you are careful.
First thing to do is remove the string, if you can. If you are desperate and neither the string nor the peg will budge, take the string off and all the other strings off by either untwisting them or cutting them with wire cutters. This will relieve some of the tension on the peg and give you much more room to work with while figuring out how to remove the peg. The clutter of all the strings can create quite a bit of stress regarding how to fix the stuck peg as it gives you another piece of the puzzle to work around. Do not let this happen to you.
Next up, try taking a screwdriver or a blunt nail of some sort and pressing it against the inside of the peg. You want to make sure that you do not scrape the peg or anything else surrounding it while doing this. That may mean getting something with a rounded tip. Take a soft mallet to the opposite end and try tapping it against the opposite side of the screwdriver so it pushes against the peg and pushes it out of the violin's scroll. Be gentle! It should only take a few mild hits with a rubber mallet or a hammer and the peg should slide out and be movable immediately.
Last thing you can try is to take lubricant and spray it along the inside of the peg so that it slides out more easily. From here you can tap it out from the inside or you can take a cloth and wrap it around the peg and turn it. This will make the stuck peg slide a lot more easily and help remove it quickly and without incident. Just be sure not to spray too much lubricant or else you might not be able to get a hold of the violin peg.