Simple IDEA plugin which allows you to take code screenshots. Just select code block and press Ctrl+Alt+Shift+A (Option+Command+Shift+A on Mac). Alternatively you may save screenshots as PNG files using "Save image as" action (no hot-key by default, but can be assigned via Keymap).
Installation page is here.