BMP Support


#1

I did a search and found this article:

http://www.juce.com/forum/topic/loading-jpgs-bmps

About the loading of BMP images.

 

I am aware of the reasons why BMP is probably unsupported (and I agree, is outdated). However, I'm working with a SDK which operates on BMP's and I have no choice on its use. That article, above, was from 5 years ago, and so I'm wondering if anything has changed? I am hoping to load a BMP using the following function: Drawable::createFromImageFile(). Is there a workaround for this?


#2

Can't you just convert from .png to .bmp (or the other way round)? Paint can do that.

 

Or are you creating bmp/png on the fly? In that case, you should be able to pass the raw pixel data instead, no?


#3

I have to create it on the fly.

 

I was thinking of doing the raw pixel data method. It's a bit out-of-the-way but if that's what it comes down to..


#4

Otherwise, Imagemagick is your friend.


#5

Another situation when you need support for the BMP format (or DIB, which is basically the same format apart from a small piece of the header) is when getting and putting images on the system clipboard. Many applications support putting a blob in PNG format on the clipboard as well, but the only format supported by the Windows API is DIB.

And I have seen that on Linux too – some applications wouldn't paste an image unless it is available as "image/bmp".

--
Roeland


#6

It's really not hard to write some code that can handle the BMP format and convert it to a Juce Image.  BMP is an uncompressed format and copying it's data to a Image object is trivial. So i would just give it a go and create your own BMPImageFormat.


#7

It'd be way too low on our priority list for us to write this from scratch ourselves. But if someone wants to get a half-decent BMPImageFormat working, then we'd probably be able to quickly get it cleaned up and added to the library.