Per IRS
Publication 526, page 11: The amount you can
deduct for a contribution of ordinary income
property is its fair market value minus the
amount that would be ordinary income or
short-term capital gain if you sold the property
for its fair market value. Generally, this rule limits the deduction to your basis in the property.
Example. You donate stock you held for 5
months to your church. The fair market value of
the stock on the day you donate it is $1,000, but
you paid only $800 (your basis). Because the
$200 of appreciation would be short-term capital gain if you sold the stock, your deduction is
limited to $800 (fair market value minus the appreciation).