-22

When is it OK to upload images of code/data/errors?

– If your answer is never, can we please talk about it?

Don't get me wrong.
I don't endorse uploading code/text in an image instead of uploading the plain text.

But: when may it be appropriate to upload code/text in an image as a complement?

The currently highest-voted FAQ answer on the topic lists 20 reasons why I should not post code (or error/exception messages, log files, configuration files, project files, or anything else that is represented in textual form) as an image.

I will scrutinize every one of those 20 cases.

A command line interface is also a user interface

Before moving on to the list, let me point out that, right below the list, there is a sentence that directly contradicts the call to never upload code or text as an image, at least in some cases.

Images should only be used to illustrate problems that can't be made clear in any other way, such as to provide screenshots of a user interface.

As we all know, a command line interface is also a user interface. Thus, when something in the command line interface other than text needs to be conveyed to the reader (for example, colorization), I argue that this may be a good reason to upload text in an image as a complement. (See this example that I discuss at the end of this post.)

The list of reasons not to upload code/text as an image

Here is the list of cases/reasons, along with my comments.

  • Images cannot be interpreted by screen readers, making them completely inaccessible for users with visual impairments.

– That's why I should always remember to provide a description of the image, and why I should never upload an image containing text instead of uploading the plain text.

  • Text can be zoomed in and zoomed out at the user's convenience, whereas screenshots typically can't be zoomed in.

– Not true. In my web browser, I use Ctrl++ to zoom in, and Ctrl+- to zoom out.
Images are zoomed in and out with the rest of the content.

  • Code or sample data in images can't be copied and pasted into an editor and compiled in order to reproduce the problem.

– Agreed.
That's why I should never upload an image containing text instead of uploading the plain text.

  • Images are large and hard to read on mobile devices, and often cost mobile users valuable data that is limited.

– I'm a Boomer. I've never visited Stack Overflow on a "mobile device".

  • Images that are very wide or tall may be scaled improperly, and can cause very squished/small text or an unnecessary amount of scroll.

– Agreed. True for all images?

  • Images can be blocked by corporate proxies, and therefore the code isn't available to those readers. This also applies to certain school networks, particularly in the US, as well as entire countries (notably China).

– Agreed.
That's why I should never upload an image containing text instead of uploading the plain text.

  • Images can't be searched and therefore aren't useful to future readers.

– Agreed.
That's why I should never upload an image containing text instead of uploading the plain text.

  • Images are harder to read than text.

– Agreed.
That's why I should never upload an image containing text instead of uploading the plain text.

  • For larger code snippets, you may require multiple images one by one, which may break the continuation, readability & extensibility. However, a very long block of code can easily be placed in a code format.

– Agreed. I think this is one of the few situations where it might be a bad idea to upload an image containing text as a complement to uploading the plain text, even if the image conveys information other than the text itself.

  • Posting images of your code is more difficult than copying/pasting the actual code and formatting it.

– Let me, the poster, decide whether I'm willing to put in the needed extra effort.

  • You're asking us to volunteer our time for free to solve your problem, and you should make it as easy as possible for us to do so.

– Agreed. That's why I should never upload an image containing text instead of uploading the plain text. In fact, this is a strong reason why I should include an image of the code/text if it adds valuable information.

  • Hosted image URLs often become stale and unavailable, breaking future ability to read the post.

– That's why Stack Exchange uses the dedicated i.sstatic.net host, right?

  • Images show a limited number of lines of code. For moderately complex questions, you cannot fit all the required code on a single screen, even when you have created the most minimal example possible to reproduce the issue at hand.

– See my comment on "larger code snippets" above.

  • Others can't help improve your question by fixing your code formatting.

– Agreed.
That's why I should never upload an image containing text instead of uploading the plain text.

  • Others can't see if an error in your code is caused by, say, invisible characters or misuse of Unicode characters that look the same (as in this case).

– Agreed.
That's why I should never upload an image containing text instead of uploading the plain text.

  • Images require more bandwidth than text: a simple 200 byte text snippet costs a thousand times less bandwidth than a 200 KB image. Since Stack Overflow serves hundreds of millions of views a day, this increase in bandwidth is significant — every byte and every millisecond count.

– OK. This calls for uploading an image containing text as a complement to uploading the plain text, only if the image conveys information other than the text itself.

  • Users with poor network speeds may be unable to load certain images at all, especially as screen and screenshot resolutions increase. Users with very restrictive data plans may even disable images entirely to save their data quota.

– Agreed.
That's why I should never upload an image containing text instead of uploading the plain text.

  • Dark theme users may find it more difficult to read text in a white box on an otherwise dark page.

– Agreed. True for all images?
(Images containing text shouldn't necessarily be black text on a white background.)

  • Images with transparent backgrounds might be perfectly visible in the light theme but completely unreadable in dark mode, or vice versa.

– Agreed. True for all images?
(You should probably think twice before uploading an image with a transparent background.)

  • The data dumps do not include images; any offline uses for the data dump, whether officially supported or not, won't see images at all.

– Agreed. True for all images? (Not just for images that contain text.)

A concrete example

In this answer on how to manually fix a single security issue in Node.js, the original poster explains why they include a screenshot of the previous text output to show colorization highlighting of the modules [they] care about :

Because the colorizing is kind of important, here's a screenshot of that last [text output].

An image containing colorized text

  1. In this case, the inclusion of an image also implicitly conveys a message saying :
    Look. I don't just talk about what commands to run. I actually ran them myself.

  2. And – if the example in the post had been reproducible – any reader who reproduces the example will get a confirmation that the result looks the same in the command line interface (if reproduced on Windows).

The bottom line

The bottom line is that, in my opinion, it's far too simple-minded to say that images containing code/text should never be allowed on any of the Stack Exchange sites.
There are cases when it makes sense to include such images.

12
  • 1
    I feel like this should be transformed into an answer on the canonical instead. Commented Apr 22, 2023 at 12:35
  • @Knechtel, actually, as I understand it, it's not even an option, as the FAQ question says: It is not currently accepting new answers or interactions. (It might be an option for moderators, but it's not an option for me.) Commented Apr 22, 2023 at 12:44
  • 13
    Because you don't do something doesn't mean other users don't, and doesn't excuse you (or others) to do something that hinders others. Saying you don't use a mobile device so using images is "ok" is like saying speeding on motorways is fine, because you don't drive.
    – Thom A
    Commented Apr 22, 2023 at 13:52
  • 7
    "Images are zoomed in and out with the rest of the content." Zooming in on a low resolution image only makes for a blurry mess. Images don't zoom like text does, the browser can't make up pixels that don't exist.
    – Thom A
    Commented Apr 22, 2023 at 14:05
  • Zooming in on a low resolution image only makes for a blurry mess. – Agreed, true if the resolution is too low to make the code/text readable. But you might agree with me that this is not the case for the image that the OP included in the post I use as an example? Commented Apr 22, 2023 at 14:11
  • 2
    In that I see no benefit of the images; there is nothing the text displays that the image does not, so the images arent needed.
    – Thom A
    Commented Apr 22, 2023 at 14:40
  • there is nothing the text displays that the image does not – Hmm, did you mean to say: there is nothing the image displays that the text does not? – The colorizing? No? Commented Apr 22, 2023 at 14:49
  • 4
    How does a couple of bits of text being yellow, rather than white, add benefit? As for syntax highlighting, code blocks support this.
    – Thom A
    Commented Apr 22, 2023 at 15:17
  • When the question is about the image, you have a rendering error or you're trying to figure out a GUI or the image is literally worth a thousand words, like a screenshot of a configuration dialog that's giving you grief. Commented Apr 24, 2023 at 16:37
  • This question seems to want to believe that the situation is black & white and you can't ever upload a picture of text. Not true. You can. If it is a good idea... I wouldn't. Especially because there are people who really do want the rules to be black & white and will start to hit buttons when confronted with a picture of text, without first thinking if they should. I like to think that the site should be used respecting the fact that you're doing so among many other human beings who do not know you, and that automatically makes things which SHOULD be possible, counter-productive to do.
    – Gimby
    Commented Apr 25, 2023 at 12:20
  • This question seems to want to believe that the situation is black & white – On the contrary! – It's not black & white, which was confirmed by the answer I accepted: "if the problem requires …". ~ there are people who really do want the rules to be black & white and will start to hit buttons when confronted with a picture of text, without first thinking if they should – So sadly true! ~ In your last sentence, are you saying: "I should NEVER challenge the black & white attitude, because people will react negatively if I do." ?? Commented Apr 25, 2023 at 12:36
  • @Henke up to you. I wouldn't, the chance of it blowing up in your face is significant. There are always ways to present something that do not require poking people in the ribs.
    – Gimby
    Commented May 1, 2023 at 12:54

2 Answers 2

13

Images can and should be used to show information that cannot be conveyed with text. For example, when you have text that appears blurred or mangled in your program, it would be of no use to paste the text in the question; you must show what you see on the screen.

Usually, there is no need to show us an image of code, error messages, or plain text appearing in a terminal window, because when we copy and paste it into our IDE, we will either see the thing we are trying to reproduce or we will not be interested in how you see the text/code. But if the problem requires that we see the text/code exactly how you see it, then add an image of the text + the text itself, so we can try to reproduce it ourselves.

8
  • 4
    It’s not clear (to me anyway) what point you’re trying to make, and there’s a lot of text. It feels like you’re trying to globally say “only upload an image if it’s physically impossible to ask your question without it”, which seems obvious/redundant to say
    – Clive
    Commented Apr 22, 2023 at 13:27
  • “only upload an image if it’s physically impossible to ask your question without it”, which seems obvious – That's not what I'm trying to say. I'd rephrase it as: “only upload an image if the image of the code/text adds something of value that the text itself cannot convey”. And my attempt at the community wiki answer is meant to say: Right, there might be cases when it makes sense to upload an image in addition to the code/text itself, but it might always be a bad idea to do so if, for example, you cannot fit all the required text on a single screen. Commented Apr 22, 2023 at 13:41
  • I had hoped that the example I included would clarify my point. But maybe it didn't? Commented Apr 22, 2023 at 13:44
  • 2
    I don’t see the difference in intent between what you said and what I did. For me it only “adds something of value” if “it’s physically impossible to ask your question without it”.
    – Clive
    Commented Apr 22, 2023 at 13:47
  • 1
    I don't seem to understand what you mean by "physically impossible". My point is that the OP of this answer chose to include an image of the command-line text, motivating it by saying Because the colorizing is kind of important, here's a screenshot of that last one. My point is that I think he did the right thing to include that image – that he had a good reason to do so. Commented Apr 22, 2023 at 14:03
  • 4
    I don’t understand why you don’t think the existing, bold, text already conveys that. Images should only be used to illustrate problems that can't be made clear in any other way seems pretty clear to me, I don’t see where the confusion comes from, and how what you’re saying improves or even changes that. But I doubt I’m going to so I’ll bow out for now
    – Clive
    Commented Apr 22, 2023 at 14:06
  • I do think that the bold text conveys my point. That's exactly why I included that text as a quotation in my question. Commented Apr 22, 2023 at 14:17
  • 4
    K, so it conveys your point; it’s already in the FAQ; so your point is already conveyed in the FAQ. Which means this question is for…? What are you asking? Do you want the bold text to be more prominent, for example? Are you suggesting a different change to the existing text? If so, what? Throw us a bone mate, this is just bizarrely cryptic at the moment
    – Clive
    Commented Apr 22, 2023 at 15:58
-15

When is it OK to upload images of code/data/errors?

You've made your point. The base rule is still not to upload any images that contain text.

If you consider uploading an image containing text, do make sure that the image adds something of value to your post. Adding an image, that contains text just for the sake of it, is pointless.

Judging from your own walkthrough of the 20 cases, you should probably not upload an image containing text (even if it carries additional information) when it's a very long block of code and/or if you cannot fit all the required text on a single screen.

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