January 04, 2023
<img id="my-image" src="path/to/image.jpg" alt="My Image">
// Get the image element var image = document.getElementById('my-image'); // Set the rotation angle var angle = 45; // Rotate the image image.style.transform = 'rotate(' + angle + 'deg)';
This code will rotate the image by 45 degrees clockwise. You can adjust the value of the
angle variable to change the amount of rotation.
You can also use other CSS transform functions, such as
translate, to manipulate the image in various ways.