532

Can we add some guidance to discourage new users from posting screenshots of their code and/or errors?

It may not be the most common problem, but I've run into it more than a few times. New-ish user asks a question and rather than taking the time to copy and paste their code or console errors into the post they try to just take a screenshot of their editor and dump it into the question...

Doing so breaks a lot of the search-ability of the post and renders a lot of the content useless to users using screen readers.


Perhaps a simple tooltip could be displayed to users when they try to post their first few images. Something along the lines of:

Images and screenshots can be a nice addition to a post, but please make sure the post is still clear and useful without them. Don't post images of code or error messages. Instead copy and paste or type the actual code/message into the post directly.


Related:
Are there any issues with posting screenshots of books/pages?
Why may I not upload images of code on SO when asking a question?

44
  • 223
    "But I cannot paste the code directly, because then the system tells me there is too much code in my question" replied the poor user. Commented Aug 30, 2015 at 18:56
  • 231
    "Ah, but you should have isolated the issue and created a MCVE." replied the more experienced user. @FrédéricHamidi
    – apaul
    Commented Aug 30, 2015 at 18:58
  • 18
    So put that in your message in the first place :) It could be an X-Y problem, so repeating the MCVE mantra just in case may be worth it. Commented Aug 30, 2015 at 19:00
  • 3
    @FrédéricHamidi I see where you're coming from, but do we really need to add an explicit "don't do this, even when trying to circumvent other filters"? Seems like a simple "don't" should suffice.
    – apaul
    Commented Aug 30, 2015 at 19:03
  • 95
    my "favorite" "screen shot". It is real, posted as is in the question (10K link at Programmers)
    – gnat
    Commented Aug 30, 2015 at 19:16
  • 17
    You are not asking for the right feature. SE continues to struggle at coming up with a good filter for the front page. This is an ideal one. Big screen-shot = -100 points. Commented Aug 30, 2015 at 22:56
  • 10
    But, what about visual programming languages like LabVIEW? Or are those just better supported elsewhere? Yes it's a corner case (see the 500 or so labview questions)
    – ryanyuyu
    Commented Aug 31, 2015 at 1:35
  • 5
    You know the biggest problem with posting error messages as text? You lose the colouring that makes them easier to read. (I carefully went out of my way on the Rust playground to make sure that the colouring remained, it’s worth while in such environments.) For the most part, adding a new syntax highlighting thing for error messages wouldn’t be impossible, but you’re not going to get normal people including the language identifiers, nor do I expect good detection semantics being applied. Commented Aug 31, 2015 at 2:42
  • 12
    What's even worse: screenshots with sample data for questions related to SQL and databases (e.g. a screenshot with the results of a query in the SQL client)
    – user330315
    Commented Aug 31, 2015 at 7:02
  • 18
    My favourite: "screen shot" of code, taken with a phone camera pointing at the physical screen, Moiré pattern and all... "because it's quicker to post that way". Can't seem to find that gem anymore, but it's there somewhere. Commented Aug 31, 2015 at 13:00
  • 3
    Another bad situation is when a question claims that a given Markdown parser is not rendering properly and instead of posted the HTML code output by the parser, they post a screenshot of how their browser is displaying the HTML. Completely unhelpful.
    – Waylan
    Commented Aug 31, 2015 at 17:52
  • 7
    Or maybe SO should implement some OCR system to help the user copy and paste code!
    – oliverpool
    Commented Sep 1, 2015 at 9:30
  • 29
    @ChrisMorgan: "You lose the colouring that makes them easier to read" -- I know some may find this hard to believe, but there was a time when we answered programming questions (and lots of other kinds too) without any syntax or keyword highlighting, and indeed without any formatting at all. In any case, whatever modest benefit might be had from differently-colored text, is completely overwhelmed by the benefits to searchability and accessibility (again, some might be surprised to find that not everyone perceives color the same way they do) that are so much more important. Commented Sep 1, 2015 at 17:58
  • 61
    You could post a screenshot of answer code(!) Commented Sep 1, 2015 at 18:12
  • 11
    @apaul34208 I'm going to status-review this for now. I've got to think about how we can implement it and not be noisy, no guarantees but we're looking at it.
    – Taryn StaffMod
    Commented Sep 1, 2015 at 20:03

6 Answers 6

88

This has been implemented network-wide. When a user has <= 15 rep, they will see a message in the image uploader that says:

Images are useful in a post, but make sure the post is still clear without them. If you post images of code or error messages, copy and paste or type the actual code or message into the post directly.

If you have less than the new user privilege (< 10 on SO) and you attempt to post an image, we will now include a link to the image and a little message to the user:

enter image description here

Previously these users would get an error message when they attempted to post.

Note: the link conversion will happen only on sites where image embedding is blocked for new users, i.e. on SO.

Basically, we aren't preventing users from including screenshots; we are just trying to discourage low rep users from including screenshots by themselves.

20
  • 1
    Is the two link maximum still enforced now that images are automatically linked?
    – Michael Myers Mod
    Commented Oct 6, 2015 at 17:11
  • 1
    Nice. Is the image converted to embedded automatically when an edit is made to the post by someone over 15 rep, or do we have to manually fix the markdown?
    – theB
    Commented Oct 6, 2015 at 17:18
  • 6
    You'll have to manually fix it, @theB. This involves typing an exclamation point. This is something you should only do if the image actually warrants embedding, which is why it's a manual step - there will be cases where that is inappropriate.
    – Shog9
    Commented Oct 6, 2015 at 17:21
  • 1
    @MichaelMyers Yes, on SO you will still need at least 10 rep to post more than 2 links
    – Taryn StaffMod
    Commented Oct 6, 2015 at 17:21
  • @Shog9 - Thanks for the clarification. Its now added to my list of things to double check when making edits. Hopefully this also means that there will be less links to questionable image hosts that need manual merging over to the stack imgur.
    – theB
    Commented Oct 6, 2015 at 17:28
  • Yes, that is the goal, @theB!
    – Shog9
    Commented Oct 6, 2015 at 17:29
  • 12
    And then people would post links to their pictures instead of the actual pictures. :(
    – GSerg
    Commented Mar 15, 2016 at 7:45
  • 12
    @bluefeet These are screenshots of code. I don't want to embed them. They should have been code in the first place. apaul34208 asked how we stop people from posting code as images and you said there's already a limitation in place. And now there are people who work around the limitation by posting links to screenshots of their code, which is even worse than posting screenshots of code :(
    – GSerg
    Commented Mar 15, 2016 at 14:04
  • 27
    really, I don't this has the necessary effect. People are still adding links to screeshots of terminal output, and code, in hundreds. A clear You must not add screenshots of code or textual error messages instead of using the text itself. would be the right thing here – also imposing a rule that allows people "justify" a downvote (or even a close vote!) on screenshot-only questions Commented Aug 9, 2016 at 12:49
  • 21
    One year later, this has clearly not solved the problem. Pictures of code rather seems to get more and more popular.
    – Lundin
    Commented Nov 16, 2016 at 15:56
  • 1
    Not allowing new users to post images will still not discourage them from posting screenshots of code. I've seen several cases where new users post links to screenshots of code. I think that along with the "you're not allowed to embed images" message they should also get the "make sure the post is clear without them" message. Or simply put it back as it was first and not allow them to post images and don't include a link for them. The best thing would be to detect if the image contains code or not and if it does block the image, but I understand if that's too difficult to implement. Commented Mar 16, 2017 at 13:07
  • 3
    Also, maybe add a close reason "this post contains screenshots of code" might be useful. Commented Mar 16, 2017 at 13:09
  • 3
    @DonaldDuck From my experience, simply blocking all image links of new users might even be better, perhaps encouraging them to work on their prose as well as their code. Maybe with a timelimit? Your post must make sense (or survive) for the first 24 hours in which the images are held back. Detecting the filetype of links would add to server load, though, and would have to be sandboxed for security.
    – jpaugh
    Commented Apr 26, 2018 at 20:04
  • 2
    Hilarious that you post an image of text without giving the text as text.
    – philipxy
    Commented Apr 17, 2020 at 4:41
  • 1
    Why is there no guidance in the Help Center (specifically stackoverflow.com/help/how-to-ask) about screenshots? It would be nice to be able to reply to questions with only screenshots of code and to refer to them to published guidance instead of resorting to a "because I said so" argument.
    – jamesdlin
    Commented Apr 15, 2022 at 4:24
156

If you are asking a question about an error or code, it needs to be in there as text otherwise it won't be searchable for other users.

I think screenshots of errors and code can be useful but only as supplementary information to the actual code/error as text. I find it helpful to see the actual error window sometimes as it helps me remember where I've seen this before or where exactly the error is coming from.

Images and screenshots can be a nice addition to a post, but please make sure the post is still clear and useful without them. If you post images of code or error messages make sure you also copy and paste or type the actual code/message into the post directly.

In rewording like this it also frames the issue positively (do this) rather than negatively (don't do this).

9
  • 3
    Do we really want a duplicate of code + picture saying the same thing? At that point I would edit out the picture. I can see a warning message that code should be in text, but after that its probably easier to replace images with text via editing ourselves and politely reminding people. Commented Sep 1, 2015 at 19:39
  • 1
    @DoubleDouble can't it just be added as alt text? If I'm remembering correctly, Stack supports that and I tend to do that whenever I can. Commented Sep 1, 2015 at 19:44
  • @SeldomNeedy I suppose it can, but whats the point of a redundant picture when only text is required Commented Sep 1, 2015 at 19:46
  • 16
    @SeldomNeedy I never want to see a screenshot of code or textual errors (unless it is to illustrate a problem with the IDE). I can't copy/paste code from an alt attribute without jumping through extra hoops.
    – cimmanon
    Commented Sep 1, 2015 at 20:43
  • @cimmanon I'd say there are a limited number of cases in which this actually makes sense to do. Having a helpful tooltip that says when this is appropriate versus not is something we can probably all agree on. Commented Sep 1, 2015 at 20:53
  • @DoubleDouble cimmanon gives a decent example; we have some grey cases where someone is using some kind of visual interface for programming (meaning it's a programming question, not a usage-question for Superuser) and then it makes sense to want a screen. I would say this should of course be the exception and not the rule, meaning I largely agree with you; askers should not be allowed to screencap just because they are too lazy to re-type a 100-character error-message assuming they cannot just paste it. Commented Sep 1, 2015 at 20:58
  • 2
    Good luck trying to "copy and paste or type" LabVIEW code. Commented Oct 29, 2015 at 16:55
  • @SeldomNeedy And, keep in mind that usage of software designed to aid programming is on topic here. (It's on topic at SU, too, but less likely to get helpful replies.)
    – jpaugh
    Commented Apr 26, 2018 at 20:08
  • @Seldom 'Where's Monica' Needy: A case where I always want a screenshot is the output of console.log etc., because the colors and what is inside an expandable section and what isn't is essential to identify subtle misunderstandings such as the poster misinterpreting the variable type (e.g. JSON versus an actual object).
    – CherryDT
    Commented Aug 31, 2021 at 17:14
20

Such a message should link to instructions for capturing error messages, since there isn't always an obvious mechanism.

Something along the lines of

except that we should probably have our own version hosted here on Stack Overflow Meta / Stack Overflow Help, and it should cover more operating systems.

5
  • 2
    CTRL+C has been available since Win95 at least - I'm not sure why a quarter century later it is still like secret knowledge.
    – AmigoJack
    Commented Jan 28, 2021 at 22:50
  • (1): The 7 ways link is dead. Archive.org is currently down, so I'm unsure if it can be recovered from there. (2) The latest version of Windows includes an ocr tool inside the Snipping Tool (opened after clicking the "you took a screenshot" notification).
    – Brian
    Commented Oct 11 at 18:44
  • @Brian: The team has had 9 years to "have our own version hosted here on Stack Overflow Meta". And OCR is not an appropriate recommendation for capturing error messages. The text is available.
    – Ben Voigt
    Commented Oct 14 at 15:21
  • @BenVoigt: To clarify, I was suggesting that OCR was something that the person posting the error message could use. That is, inability to figure out how to copy in the error message is not an excuse. In my experience, OCR is pretty reliable for capturing text from full resolution screenshots, since screenshots typically lack errors/artifacts. I'll admit there's some risk of error...but that also applies to manually type out the error, To be clear, OCR isn't a good solution. It's a, "you have no excuse" failover that, in my opinion, is a bit less obnoxious than, "type it out by hand."
    – Brian
    Commented Oct 14 at 17:00
  • @Brian: BTW Some of archive.org mirrors seem to be up: archive.today/20160308132211/https://www.raymond.cc/blog/…
    – Ben Voigt
    Commented Oct 14 at 18:02
-9

I agree that most screenshots of code are pure lazyness. And especially because putting stuff in working code will force you to think about what you've done, it is good to enforce a rule like: 'avoid posting screenshots of code'.

But, I can think of a good reason to add screenshots and sometimes even omit the code itself. IDE's like Android Studio can display lots of debug info right next to the code, which will often show that the problem you have is not because of bad input values. Then, the code itself may just be disturbing extra and the screenshot may be much more useful. Moreover, in a screenshot you can grab multiple parts of multiple windows, which can give a good overview.

I'd say it all depends on whether the poster has thought about how to best present the issue, and decided knowingly to (also) post the screenshot(s).

-34

I agree with this, but...

Don't ask the whole text of the error message.

Sometimes, it's not possible to obtain the text of a console error or multiple errors. This is a big problem when debugging in IE11 or when you have a specific CSS behaviour that should(n't) happen (this point is arguable).

Sometimes, the user simply doesn't know how to copy those. Or the error is simply a broken image or something.

There are many situations. Each computer and situation is different. Asking for the text representation of a very peculiar error when you can't (Example: a message box) is off-putting.

In the situations that it is possible to re-type the whole message, please do so. If not, at least include the title/error number with part of the description and use the image as a suplementar media.


In conclusion, only ask for the code in textual form. It's silly to even have the code in a printscreen.

30
  • 6
    If you have a long message box error, you should still type out the title or something relevant from it so that it's searchable. And then post it with the screenshot.
    – DanielST
    Commented Sep 1, 2015 at 17:52
  • 13
    If you can't copy-paste the error (this is assuming only the cases where you actually get an error message- In cases where, say, your css moved the image the wrong way... Well, there's no error there to even consider. It's just not behaving as intended) then it should still be typed into the question. You can't Google an error and get the image based on the text in the image- At least, not yet. The error needs to be typed out, be it manually or by copy-paste, somewhere in the question.
    – Kendra
    Commented Sep 1, 2015 at 17:52
  • 26
    " it's not possible to obtain the text of a console error or multiple errors" -- if the person asking the question can view the text, they can type it in. Yes, copy/paste is most convenient. But it's always possible to include the exact text of an error message that is relevant to the question. As for "multiple errors", frankly it's a good thing for users to be inhibited in that scenario, lest they drop a huge mass of errors, most of which have nothing to do with the underlying problem, into their post. If all those error messages are important, the person can damn well type them all in. Commented Sep 1, 2015 at 18:02
  • 1
    "But re-typing 500 characters is so off-putting that makes people give up from posting. Do you really think anyone would write all the errors?" Just to be that person- I would. =) (Granted, I really like typing... A lot... So I may be the exception.) To answer your comment to me, your answer does indeed look better.
    – Kendra
    Commented Sep 1, 2015 at 18:12
  • 5
    @IsmaelMiguel you at least must have typed the relevant part of the error message to google it...
    – 1010
    Commented Sep 1, 2015 at 18:16
  • 19
    "But re-typing 500 characters is so off-putting that makes people give up from posting" -- I doubt that there is actually an error message that contains 500 characters that are all actually important to the comprehension of the question. But if such an error does exist, then yes: if someone wants an answer to their question, they damn well better be prepared to type in all 500 characters. The biggest liability SO has is all the lazy people posting questions that they can't be bothered to present in a useful way. The more we discourage those people, the better. Commented Sep 1, 2015 at 18:19
  • 11
    "for those who can't post it in a textual way" -- you are talking about a mythical, non-existent person. Communication on the Internet is inherently textual. There is not a single person using the Internet for communication that is literally incapable of posting information as text. There are only people who are too lazy to input the text that is required for best, most efficient use of the technology. Commented Sep 1, 2015 at 18:23
  • 1
    Are you talking about an error message with 500 random characters? In that case why not just say, "error message box with random characters/gibberish"? It is unlikely the message means anything useful outside of error codes, obvious identifiers, or the first 10 characters. However, if the exact gibberish is relevant, I would agree that an image as supplemental information would be a good thing. Commented Sep 1, 2015 at 19:58
  • 11
    "Because there's nothing efficient about re-writing an error message" -- let's do go there, because the question of efficiency has to include the whole picture. The entire point of Stack Overflow is that people can search its contents to find the answers to questions that have been asked previously. This is negated when the information is not textual. "Efficient" does not mean "least effort in the short run". Commented Sep 1, 2015 at 22:44
  • 1
    @PeterDuniho Basically, if I have a message saying "Unhandled exception blah on blah on blah on blah on blah on blah ... ", I have to write that whole stuff? The example I'm going to give is a bad one because it has the textual representation of the error: i.imgur.com/Zhp5fUd.png But now imagine the same error without the text box. How screwed would I have to be? Commented Sep 1, 2015 at 23:10
  • 19
    "How screwed would I have to be" -- honestly, if you can't be bothered to take the minute or so it would take to transcribe the error message shown there, why should you expect anyone else to take the time to compose a useful answer to the question? It's not like anyone's insisting you transcribe War and Peace or anything like that. Quit whining, and get on board with posting useful questions. Questions that include critical information as images instead of text are simply not useful. Period. I don't care how hard it seems to you to type it in; you still type it in. Commented Sep 1, 2015 at 23:18
  • 9
    "I'm just exposing a problem that (I don't have but) may happen to some other users" -- Your comments are all written in the first person, so forgive me for thinking it was you with the problem. That said, no one has the problem. It's a non-problem. You have imagined the problem. Typing the question is what questioners are expected to do, and they are expected to type all of the important details. If they cannot copy/paste the text but also cannot be bothered to type the text by hand, they don't deserve an answer to their question. Commented Sep 1, 2015 at 23:57
  • 6
    @IsmaelMiguel: Why are we arguing about how much text is too much to retype. You should never retype, that introduces transcription errors Instead, learn how to capture the error message in text form
    – Ben Voigt
    Commented Sep 2, 2015 at 15:46
  • 3
    @DoubleDouble: "I disagree with having such absolute thinking" -- it doesn't really seem so, as you in the same comment wrote "I do think both should be there". I'm not saying images of errors can't be useful, just that they can't be used instead of the actual text. Please note also that this entire Q&A is about "code and error messages". Comments must be brief, so I take as given that readers can keep the context in mind, so that I don't have to keep restating that we are talking about code and error messages. Commented Sep 2, 2015 at 16:30
  • 2
    @DoubleDouble If you prefer that the entire error be in text, you are welcome to edit it might as well be saying "If someone needs to rewrite the error I was too lazy to type so that they can answer MY question, then that's on them." It's a fact that Code/errors posted as images are next to useless. It's also a fact that you don't know what's relevant in the error, or else you'd have fixed it. If you aren't willing to guarantee you've included all the relevant information in your question, then don't expect people to be willing to answer it. Commented Sep 8, 2017 at 21:08
-63

If posting a screenshot is easier for the user than posting the code, then maybe the system should gently bend itself towards that?

Posting code on SO is actually quite hard and I’ve struggled with it myself. When you paste a bunch of code, it starts off as being formatted as text, and you must do lots of work to restore the indentation and the like.

Maybe this is a source of pride for some people who can do that, but in some cases I’ve honestly found myself thinking that instead of messing around in the Markdown editor, I’d like to drop a screenshot in from where the code gets OCRed out with already the correct formatting.

Maybe it’s required qualification for using the site that you can correctly format and post code. Or is it another of those things that discourages new people? I don’t know, I haven’t studied usage as much. But certainly the code-posting experience itself could also use improvement. Maybe also something like, if you paste in something that looks like code, then apply correct formatting to it, don’t require me to do gruntwork to fix it.

15
  • 45
    You consider pressing one button "lots of work" to format the code as code?
    – Servy
    Commented Sep 1, 2015 at 15:11
  • 12
    Select your code and then press the code ({}) button to indent it. It will add 4 spaces infront of each line. The "other" indentation (like code in a method) is kept as it is, but you're IDE should format that anyway.
    – Tom
    Commented Sep 1, 2015 at 17:43
  • 24
    "Posting code on SO is actually quite hard" -- if there are things that SO can do that makes it easier for users to post questions that are well-formatted and easily understood, then by all means those types of features should be requested. But the issue here is that screenshots in lieu of actual text detract from the usefulness of the question. It might be hard to post a good question, but it's a lot harder to answer a bad question. Commented Sep 1, 2015 at 18:05
  • 3
    If formatting in the question post itself is difficult for you, pre-format the code in a text editor / programming editor and make sure the least indented lines are 4 spaces (or I think equivalently one tab?) indented. You can do this in Notepad++ and many others by selecting the code and using TAB/Shift-TAB to correctly indent. Then copy/paste into the appropriate part of the answer.
    – Eric J.
    Commented Sep 1, 2015 at 18:26
  • 9
    Honest question: what is so hard about it? The way you describe it I am imagining the black and white "struggling consumer" from a bad infomercial! There is no Markdown formatting to it. It's just regular code with an extra 4 leading spaces. Honestly I didn't know about the auto-format button because it's so easy to do in Vim. Maybe something to do with the runnable snippet thing that I never use? Commented Sep 1, 2015 at 18:28
  • 1
    @Two-BitAlchemist I don't think "hard" is the best word to describe the problem. I would use "unintuitive" and "continuously annoying". The fact that the interface is not intuitive is easily seen by looking at the number of edits that are necessary to "fix code formatting". In the C tag, posts by newbies frequently require a formatting edit by a more experienced user. Why is that? There's something obviously wrong with a system where a newbie can't successfully post some code without assistance from a more experienced user. Commented Sep 1, 2015 at 18:43
  • 15
    @user3386109 Why? Because the newbies can't follow directions. Seriously. Four leading spaces is not that hard. I make a lot of these edits and it's all the same kinds of problems: actually but 8 or 16 or 20 leading spaces, didn't quite put 4 leading spaces, tried to use inline formatting to format a block, etc. What do you propose to do about that? There's already a button, a tooltip, and a big expandable example that explains how to do it, but these people still don't get it. Commented Sep 1, 2015 at 19:20
  • 1
    @Two-BitAlchemist LOL, blame the user... Commented Sep 1, 2015 at 19:57
  • 7
    @user3386109 As opposed to blame the platform? It's not like StackOverflow isn't bending over backwards here to make it obvious what you're supposed to do, and yet every day we are bombarded by nonsense from people who obviously haven't read all the warnings, help, etc. I ask again: what do you propose to do about it? We can snark back and forth all day about whose fault it is, but you're suggesting it's on StackOverflow to "do something" -- what, then? What is your fix? Commented Sep 1, 2015 at 20:00
  • @Two-BitAlchemist To experience a different UI, go post code on Apple's developers forum. On Apple's forum, the indentation is easy to get right. But the newbies always end up with code that's ________. Fill in the blank, and we'll talk. Commented Sep 1, 2015 at 20:05
  • 7
    @user3386109 So make a feature request that StackOverflow do it the way Apple does it, whatever that is? I don't even have an account there so I think "Go make an account and spend enough time there that you understand the pros and cons of their system" is very fair or even relevant. Honestly I did poke around their forums a little bit but I don't see any way to get an idea what their UI is like, and tbh the few code samples I did find had formatting problems, just like ours do. Commented Sep 1, 2015 at 20:13
  • 6
    @user3386109> if Apple's platform is so great, I see no objection to letting all the guys who are too lazy to spend 2 minutes to type their own problem so people give them free help go over there. Seriously, how can you expect someone who can't even get basic text formatting right to write code?
    – spectras
    Commented Sep 2, 2015 at 4:00
  • 4
    @user3386109 While we should always be looking for ways to make things better, SO's mark up is hardly that difficult just for simple code formatting. It is simply not that difficult to spend 10 minutes looking at the formatting options and figuring it out; you just mouse over the buttons and maybe try them to see what it does. At some point, the user really is just being lazy, and that's not fair to people offering free help.
    – jpmc26
    Commented Sep 2, 2015 at 13:55
  • 2
    To be fair I don't think we can expect people whose question amounts to "Code not working, plz fix' and dumping their entire code base into a question can be expected to spend any extra time how to format their post.
    – kylieCatt
    Commented Sep 2, 2015 at 15:38
  • 9
    Did everyone here forget that not everyone can read images and images tend to rot away? And even if an OCR program could fix the issue, and we had a lot of servers dedicated to handling it, how do you handle the case of someone taking a full-page screenshot? Commented Sep 2, 2015 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .