In theory it's not impossible, however, if you are asking the question, then I'd strongly recommend you do not try.1
My PC does not have any SD card slot.
Ah. Well, unless you are in prison or orbiting the Earth, it should be pretty easy for you to buy a USB SD card reader.3 These vary in price up to ~$25 USD, but if you are happy with USB 2.0 speed (which is fine for writing images), then they start at ~$0.99 online (including shipping! which may take a long time, don't fall for that). Meaning if you live near a big box or department store you can probably find one for $5-10, or at a pharmacy, etc., marked up by 50%. Beware different SD card sizes (chances are you have an adaptor for that already as they commonly come with micro cards).
OTOH, if your time is worth absolutely nothing to you, you could try my suggestion in the footnotes at no cost. I'd bet against you though, sorry, so you might want to first set a time limit on your no-cost hours.
The "theory" I have in mind is that if you can create a root filesystem in memory and chroot
or otherwise swap into it, you could then do whatever you want to the card. The final problem is then where to source the image from; if you have a big enough card whereby you might be able to have an extra partition, 2 you could put it there and possibly partially overwrite the card from the beginning -- but probably not, meaning the only option is to stream it over a network. Which will be the easy part.
Yes, chained footnotes. If you do have room for an extra partition on which an image would fit, the saner approach would be to write a root fs into it and just change root
in /boot/cmdline.txt
. This is a slightly more complex procedure than just writing the image to the card because you will have to extract the root fs partition out of it instead.
Unless you computer does not have any USB ports either, which would be pretty unusual.