Without disclosing specific details, I feel you would benefit from better responses if you provided a little more information, because I'm reading a lot of assumptions into your request. Maybe considering the following questions would help clarify what you want to do, because I'm a little confused
1. Is this a totally custom image, a plain Raspbian image, or a Raspbian image that you are customising for an IoT project?
2. How many partitions does your image have?
Standard Raspbian has a small FAT32 boot partition plus an ext4 rootfs that is normally expanded on first execution to fill the rest of the card. You mention writing to a 32GB card.
3. Will you always target a 32GB card, or maybe different sized SD cards?
I want to root partition have 8 GB area, then other files have different size (configs 3GB etc.)
4. You mentioned making the root partition a fixed 8GB in size. What will you be doing with the other ~24GB of SD card space? Did you mean to create other partitions
(of 3GB etc) for your configs?
Can we set .img file like this before writing the SD card?
5. Yes, But there are several ways you can do this. What is your motivation?
If we could make this custom image, this provide us huge save time.
6. What is taking too long at the moment? Do you mean the expansion of the partition is taking too long?
You could create an SD card with the exact sized partitions you need and then take an image of it (with e.g. DD or win32diskimager). This image will be quite large and will take a long time to write. You could zip it to save space. You can write it back to new SD cards using Etcher (which understands zip files). As others have said, this will restrict you to writing it to an SD card of the same or larger size. Not all 32GB cards are the same size, so you would need to make it a few MB smaller to be more sure it would fit on them all.
OR, you can create an image with minimally sized partitions and use first-boot scripts to expand them to the required sizes (like Raspbian does) so it fits on a wider variety of SD card sizes.
It is not clear to me what your main concerns are that need addressing. Maybe answering these questions will help others provide better suggestions that are more suited to your needs.