Use the blacksmith's "Extract gem" service to remove gems from items which you will find in the blacksmith's recycling section.

The removed gem lands in your inventory. Unfortunately, the item in which the gem was socketed is destroyed without replacement. However, you will receive a proportionate amount of resources back if this item was previously upgraded by the blacksmith. This does not apply to e.g. weapons that were thrown into the toilet as they lose their sales value there.

To extract a gem an item must be unequipped, drag an item onto the corresponding area at the blacksmith,  or use the right-click context menu on the item whose gem you want to extract. Items from which gems can be extracted are highlighted in your inventory.

Extract Gems

Extracting a gem costs metal and arcane splinters. Alternatively, you can also spend 10 mushrooms.