Unfortunately you need to sell your stocks as a loss first before transferring the money to your TFSA. And if you do sell as a loss, you should wait 30 days before buying again to avoid the superficial loss rule. Some more information...
"If the stock you want to transfer into your TFSA has fallen in value you cannot claim the loss for tax purposes. In order to claim the loss you’d have to sell the stock outside the TFSA first. But be mindful of the superficial loss rule, which prevents investors from selling a stock to claim a loss and then buying it back in right back. If you sell the stock outside of the TFSA and buy it back within 30-days, the loss will be denied."
... View more