If you have an install of pi os or anything else you want to backup you can copy it to an img file which can then be burned to a new sd card. This is accomplished with the dd command.
sudo dd if=/dev/sdc of=/home/afleak/sdcard-backup.img bs=64K status=progress
The img file created will be the size of the sdcard so if for example it is a 64gb sdcard the img will also be 64gb in sixe
To use: A good idea is to make a copy of your image just in case
something goes wrong. Then sudo pishrink -v nameof.img
The -v turns on verbose messages so you know what pishrink is doing. you can also specify a second image name in the command line if you don’t want to overwrite the first one.
the image should rezise itself the first time it is copied back to an sd card and ran.