@ayrp It's very positive that you are aware of your issues. It sounds as though you have an amazing guy who really appreciates you, and you need to work on accepting that. I wonder if your actions come from some sort or fear or insecurity?
Have you ever tried mindfulness? That might help. You need to get this under control soon as the last thing you want is to be so unhealthy that your boyfriend starts resenting you. That would not lead anywhere good. Well done for reaching out for advice, that is a hugely encouraging sign. If you want to change, you'll need a lot of determination.
I suggest that when you next talk with him you mention this, apologise for how you've been with him. Communication is the foundation of any strong and lasting relationship, and you need to trust and understand each other. Tell him exactly what you have posted here. If saying it is too hard, write it to him. Then look at each of the problems and tackle them one by one. For example, you mention the way you are when he wears shorts and posts pictures. You're aware your reaction is toxic and inappropriate. You could start with that. Allow yourself to become more accepting and understanding. They are just legs after all - when the weather is warm would you prefer your boyfriend to get hot and feel uncomfortable? To not get the vitamin D he needs from the sun? If you had a female friend whose partner would react poorly if she wore a skirt, would you think that logical and right or would you think your friend should be able to wear what she wants and the guy aas being an asshat for trying to control her? I think that when so many people in relationships are so ready to flirt/sext/share intimate pics or even cheat, if the only body part of your boyfriend's you have to worry about someone else seeing is his legs you have landed extremely lucky. What you would do if the two of you ever went to the beach or swimming or such?
Much behaviour is a choice, even when it is extremely hard. You want to change for the better, and I believe you can. Stick to it, because it will be worth it. You will both be far happier in the long run. Best of luck to you.