I am new in Raspberry Pi. I want to ask that I have downloaded RaspAnd for Raspberry Pi but its size (7.9GB) is greater than my SD Card size(7.21). I have checked that the .img file has four partitions from one is for storage which has 5.9GB storage. I want to reduce it to 5.0GB so I can write my Image to my SD card, so how can I reduce that specific partition size?
You may want to try this script https://github.com/Drewsif/PiShrink. It mounts the image file, resizes its partitions and truncates the file afterwards. You have to run it on a linux machine with enough space.
If you want a simpler solution. Use some tool to overwrite unused space on the SD card with zero and then you can simply compress the image efficiently.