When using the react-webcam package, I am encountering an issue where the captured images are in a horizontal orientation. To solve this problem, I need the image to be displayed vertically by rotating it 90 degrees.
The method currently used to capture the image is this.webcam.getScreenshot()
. I have been attempting to adjust the properties of this method to ensure that the resulting image is rotated at 90 degrees for vertical display.
Despite trying to rotate the preview before capturing the image, the output still remains horizontal. My goal is to rotate the image automatically upon capture.
I attempted the code snippet
// imageSrc.css('transform','rotate(90deg)');
, but unfortunately, it did not work as expected. It's worth noting that the captured image is in base64 format.
In my setup, the webcam serves as the preview for capturing images, and the capture button is activated by a separate button click event.
capture = () => {
const imageSrc = this.webcam.getScreenshot();
this.setState({
picsArray: [...this.state.picsArray, imageSrc],
})
};
Expected Outcome: The captured picture should automatically rotate 90 degrees when using the provided method.
Actual Outcome: Despite efforts, the image does not rotate as desired during capture, leaving me unsure how to resolve this issue.
Thank you for your attention to this matter.