# Why would a bitmap display in a browser as completely black?

**URL:** <https://boards.straightdope.com/t/why-would-a-bitmap-display-in-a-browser-as-completely-black/623556>\
**Category:** Factual Questions\
**Created:** [May 30, 2012, 5:02pm UTC](https://boards.straightdope.com/t/why-would-a-bitmap-display-in-a-browser-as-completely-black/623556 "2012-05-30T17:02:56Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Athena](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@Athena](https://boards.straightdope.com/u/Athena)\
**Post date:** [May 31, 2012, 12:18pm UTC](https://boards.straightdope.com/t/why-would-a-bitmap-display-in-a-browser-as-completely-black/623556/21 "2012-05-31T12:18:54Z")

</div>

> [@ZipperJJ](#):
>
> Another thing you could try is a converter that converts your BMP to GIF, basically disallowing BMPs in the database. That is if file type doesn’t matter and you have access to the upload part.

Yeah, we could try a translation like this.

And truly, I can easily enough just say “we don’t support bitmaps.” That would be an OK solution. But at this point it’s become personal; I want to figure out why the !#$$#@ this isn’t working because from outside appearances, there’s no reason it shouldn’t.

---

<div class="post-metadata">

**Author:** ![Mangetout](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mangetout/32/19_2.png) [@Mangetout](https://boards.straightdope.com/u/Mangetout)\
**Post date:** [May 31, 2012, 4:15pm UTC](https://boards.straightdope.com/t/why-would-a-bitmap-display-in-a-browser-as-completely-black/623556/22 "2012-05-31T16:15:33Z")

</div>

Just a thought… nobody has been dicking with the htaccess (or equivalent, if the web server isn’t Apache), have they? Nobody has been trying to prevent image hotlinking or anything like that?

---

<div class="post-metadata">

**Author:** ![Omphaloskeptic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@Omphaloskeptic](https://boards.straightdope.com/u/Omphaloskeptic)\
**Post date:** [May 31, 2012, 4:36pm UTC](https://boards.straightdope.com/t/why-would-a-bitmap-display-in-a-browser-as-completely-black/623556/23 "2012-05-31T16:36:11Z")

</div>

Would it be possible to provide a sample public web page with examples of working (non-bitmap) and non-working images?

---

<div class="post-metadata">

**Author:** ![Athena](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@Athena](https://boards.straightdope.com/u/Athena)\
**Post date:** [May 31, 2012, 5:12pm UTC](https://boards.straightdope.com/t/why-would-a-bitmap-display-in-a-browser-as-completely-black/623556/24 "2012-05-31T17:12:39Z")

</div>

> [@Mangetout](#):
>
> Just a thought… nobody has been dicking with the htaccess (or equivalent, if the web server isn’t Apache), have they? Nobody has been trying to prevent image hotlinking or anything like that?

Not Apache, and nobody’s been screwing around with access.

> [@Omphaloskeptic](#):
>
> Would it be possible to provide a sample public web page with examples of working (non-bitmap) and non-working images?

Not without a lot of work.

Update: I never did find the reason as to why this is happening, but I have a strong suspicion that something is getting truncated when I write it to the output stream. \*\*Shalmanese \*\* suggestion to right click and save shows me that what’s written to the browser is not the same size as the file itself.

Why that’s happening is a mystery; I’m using standard calls to copy the stream I get from the DB to the HTTP output stream, and it works with every other file type.

I found a workaround, though - I’m just pulling the image from the DB and hosting it from my web service, and that seems to work with all file types. I hope to eventually figure out why it’s not working the other way, but for now, I’m good.

Thanks for all the help.

[Previous page](https://boards.straightdope.com/t/why-would-a-bitmap-display-in-a-browser-as-completely-black/623556.md?page=1)
