Well, when I was new to the site I also posted my first question as an image.
So, In my opinion, the reason why people post code as images when they are new because they don't really know how to put the whole code in question and when they see a text editor while posting the question then they think they have to type it all again! but they soon realise this is highly impractical. And then they think a screenshot would be good idea to post the whole code. So that's why..
UPDATE
So let me elaborate more Why do people post code as images?
- First of all, the question title should be "Why new users post code as images"? Of course, a experienced user would never do this.
- It is not really the case that new users like or prefer to post code as images they simply don't aware or didn't read "how to post good questions" before posting the question.
- And once they posted code as image, it is very likely that a community member will comment "Please don't post code as image and copy/paste the code and format it using
ctrl+k
.
- After this they will post code as code in their future questions and answers because they now know how site works.
WHY I POSTED MY FIRST QUESTION AS IMAGE?
So, firstly I was in the same situation I described above.
And after that, when I was writing my next question it was of about 5-6 lines of code so I decided to write directly in text editor of question area and don't formatted code(just wrote the code) because I was really not aware of formatting using ctrl+k
or backticks.
And after few minutes, the code was magically formatted! I was really surprised and have no clue how it happened and then I thought there may be a automatic system of code formatting on SO.
But on the same day, I saw a question(unformatted code) in a user has commented "Please format your code using ctrl+k
. So from where I came to know how code formatting works.And then I realised my code might be formatted by a community member.
MY SUGGESTION
Since In the text editor all the options to write question are clearly visible and If a new user carefully observe this and read help center before actually posting the question then he/she will certainly not post image instead of code.
So, In my opinion, On the "Ask a question page" slightly up before the "Title". We should include two little lines:
- You can copy/paste your code as it is here and no need to post image of your code.
- And you can then format your code using
ctrl+k
or backticks.
Because these are the two common mistakes new users generally do.
I am suggesting this because most people don't really read "How to format" and the help center before asking the question for the first time and they just post the question. And if those two lines would be just above the "Title" users will definitely read this.
PS: So I shared my personal experience and that was all and by these suggestions I didn't really mean that site already has not those features. And if a new user just read "How to ask" and maybe help center carefully then he would definitely post a good question even at first time.
But... As you know
There is no solution of Human stupidity