Select a code and press a hot-key (Ctrl+Alt+Shift+A by default) to copy it as the image (make a screenshot).
Default hot-key can be changed in Settings|Keymap (search for "Copy as image" action)
Additional "Save as image" action is available which allows to save PNG file
Some plugin options are available under Editor|Copy image options
Recent change notes
Ability to add padding to the screenshots
Ability to save into file
Thanks to Andrew Starovoyt for contribution!
General usage instructions
Select code fragment and press Ctrl+Alt+Shift+A to copy (Option+Command+Shift+A on Mac) it as high resolution raster image preserving all the editor features (inspection highlighting, code folding, parameter hints, etc.)