Copied from Here:

Create SD image:

Use Win32Disk or Rufus to create SD from downloaded image. OBS! use a SD card just big enough to fit the image file - otherwise you will end up with a huge new image file.

configure using 'raspi-config' OBS! do not resize the linux partition. (first option in raspi-config)

ex. change international settings, enable drivers a.o.

exit 'raspi-config' without reboot.

Options:

install initial application (OBS!: there is a limited amount of remaining space in the partition as the partition has not been resized to fit the SD)

optional change root password.

Shutdown Pi:

sudo shutdown 0

Power off the Pi and remove the SD-card

Create new SD image:

Use Win32Disk to read the SD into a new image file. (ex. newImage.img - it will have the size of the SD-card)

Save the file to an USB-stick.

Put the SD back in the Pi and power up.

Mount the USB stick:

Insert the usb-stick into the Pi.

Create a folder:

sudo mkdir -p /media/usb

Mount the USP-stick:

sudo mount -o uid=pi,gid=pi /dev/sda1 /media/usb

Resize SD image file on USB:

Use fdisk to find the ind of the linux-partition:

fdisk -l

Replace the "end of linux partition" in the following command with the end- position of the linux-patiion (asume /dev/mmcblk02)

truncate --size=$[(end of linux partition + 1)*512] /media/usb/<newImage.img>

<newImage.img> should be replaced with the name of the SD-image on the USB-stick

After running the above command, the SD image file has the same size as first created.

Usse this image to make new SD whenever you need it. Remember to run raspi-config and expand the partition the first time you use the new SD card.