Can a druid get out of wild shape to avoid an opportunity attack?

Suppose a druid is shapeshifted into a beast of large size and adjacent (within 5 ft) of an enemy with a reach of 5ft.

On the druid’s turn, he reverts to humanoid form, reducing his size from large to medium and placing him out of the enemy’s reach. The druid can now move away without giving the enemy an opportunity attack.

Is this correct?