I'm not so sure about replacing the source with an image, but you can have inline images as results to source blocks.
If you add the startup option "
inlineimages" to your buffer, any links in your buffer that point to local images it understands will be rendered.
If you don't have a startup options block, it would just be a line at the top of your file that looks like:
This only fixes half of your problem though...when you
C-c C-c a block that spits out an image, you will get a link rather than an inline image...
Luckily, you can fix this by adding the following to your Emacs config:
This will allow you to see images inline when you first open the buffer, and update them by evaluating the block source.
Now, as for the whole source-replacing business:
I'm not sure how to do this inside of your Org buffer, but in Org exports (To HTML, PDF, and so on...), if you don't want to show the source blocks that generate their results, you can add an "
:exports results" argument to the head of your code block. This will make it appear as though the source has been replaced with your image result.