[BUG] Screenshot bitmap files with incorrect header

I have been experimenting with batch conversion approaches to screenshots and was attempting to do so using Python’s PIL module to do so. However when doing so it leads to and error on line 132 of the below file:

The bug arises because Unreal is outputting .bmp files with the BI_BITFIELDS compression flag set - although it is not using any known valid compression format. There are three acceptable flag conditions in the file linked above the error thrown (line 132). The first acceptable “compression” is actually a 32 bit file where the last 8 bits (alpha) are ignored. The other two appear to be the 565 and 555 methods of compression (see The BI_BITFIELDS bitmap type - virtualdub.org).

PIL, when noting that the compression flag is set, does not expect an uncompressed 24bit file. The standard 24-bit(888) which Unreal appears to be using should not have the compression flag bit set.

Is there any reason as to why the flag bit is set for Unreal screenshots? Is there any way around this weird bitmap format that the engine is outputting so that I can leverage the automated process I have defined?

(I am aware that my use case is a very esoteric one however it does highlight an issue with the bitmap files being created through screenshots)

Hello GerardD,

You do bring up a really great issue. Since it has been some time since this was originally posted, I would like to follow up and see if you were able to find a work-around, or if the issue was resolved.

Since this post, we have had some updates to our features and some fixes. I looked in the release notes and did not find anything specifically related to this issue, but I could be overlooking it.

One workaround I would suggest would be to use the High Resolution Screenshot feature. ‘You can save rich frame data including HDR colors and 16-bit pixel depth into an OpenEXR file. This is really useful for offline compositing work.’

If you are willing, try updating to version 4.6 and see if this does not resolve your issue. If you are still experiencing it however, let me know and we can further investigate.

Thank you,

Andrew Hurley

Hi Andrew,

Thank you for looking into this issue. I have just tried to take a normal screenshot using 4.6 and encountered the same issue when attempting a convert using PIL as mentioned initially. In relation to the HighResShot command I recall having a number of issues with it reliably creating the file (generating a friendlier png file) using this method and as a result focussed on finding a solution that was able to deal with the bmp file as it was being generated rather than settings within UE4 itself.

To this end I eventually created a working solution by interfacing with the ImageMagick (http://www.imagemagick.org/) library. This solution, whilst not as straightforward to implement as PIL originally was, seems to be less concerned with this particular inconsistency with the screenshot being handled and achieved the aims of the project at the time.

I am also hindered by this issue. It seems that only windows paint is able to open this image. I want to make a video of an image sequence but none of the images can be opened.

To fix the images I used ImageMagick from the windows command line. It should also work for other OS’es:

I downloaded the 8bits per pixel/64 bit/dynamci binary ImageMagick-6.9.1-0-Q8-x64-dll.exe
from ImageMagick – Download

Then simply open a windows command prompt window.

change directory to your screenshots

cd Documents\...\...

and use the mogrify command:

mogrify HighresScreenshot*bmp

Mogrify will “convert” the image in place and so fixes the wrong file format.