I am trying to use the Raspberry Pi Camera to take pictures and videos. It was all working fine for about 3 days, after which things started to go downhill. First, I noticed that the website where I was streaming the Raspberry Pi's video showed the unloaded image sign (https://www.thewindowsclub.com/wp-content/uploads/2018/06/Broken-image-icon-in-Chrome.gif). Therefore, I went back to my raspbian terminal and tried basic commands. First, I tried this:
raspistill -o /home/pi/Desktop/image.png
This worked perfectly the past few days, and I thought it worked again, until I opened the image. Image Viewer said that the image is not a PNG file at all. This was the popup:
Fatal error reading PNG image file: Not a PNG file
After looking up the error, I reinstalled the PNG library, and still no luck. So, I decided to use jpg instead. I next executed this:
raspistill -o /home/pi/Desktop/img.jpg
And... I got another error:
Error interpreting JPEG image file (Not a JPEG file: starts with 0xc5 0xdb)
After looking it up again, I used this command:
file /home/pi/Desktop/img.jpg
I got the following output:
/home/pi/Desktop/image.jpg: data
So... if the jpg file is actually a data file, what is the problem? Also, it was working perfectly for the past few days in a Python script and with the terminal... What happened now?
Some additional information: I always use xrdp to Remote Desktop from my Windows Laptop to my Raspberry Pi (4 B+). Therefore, I cannot see if the preview works or not. I am using Raspberry Pi Camera Rev. 1.3 and Raspbian Full 32-bit.
Some more important information: This error started occurring after an incident that I can't explain. I had my Windows Laptop connected to my Raspberry Pi with Remote Desktop, and I accidentally pressed the Sleep button. When I woke the laptop again, it said Remote Desktop terminated unexpectedly. I kept trying to reconnect but it wouldn't work. So, I unplugged the Raspberry Pi and plugged it in again. After I used Remote Desktop to connect to it again, it started doing this. This made me think it was a software problem, so I enabled and disabled Camera from Raspberry Pi Configuration and raspi-config
, but it was no use.
I am stuck and don't know what to do. Any help would be greatly appreciated. Thank You in advance.
EDIT: The preview shows up perfectly, it's just the saving of the image that somehow gets corrupted. Is there any way to re-install raspistill?