Using blender generated bitmaps in Windows applications

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
arrand
Posts: 0
Joined: Mon Jan 08, 2007 5:44 pm
Location: London UK

Using blender generated bitmaps in Windows applications

Post by arrand »

Apologies if this is off-topic for this forum, but I've drawn a total blank on other forums/documentation with this...

I'm writing a C++ Windows application that uses Blender images that includes the images as bmp resources. When the Blender images appear in my app window, the colours don't look right, they are slightly different to the way they appear in Blenders render window. This seems to be because Blender dithers some of the colours to give very smooth fades in colour.

The Microsoft bitmap library on the other hand seems to show pure colours which means steps in the colours can be clearly seen and gray scales have steps which are slightly 'off-grey' (have more red, green or blue in them). Turning on the dither option in Blender improves the output but doesn't solve the 'off-grey' colour problem.

The bitmaps look as good as in Blender in other apps like Photoshop and Windows Picture Previewer - they appear dithered in a similar way. Windows resource editors and the Paint program in Windows display the images with the colours in the same way to my app, i.e. without dithering.

Is there a C++ library that will display the bitmap in the same/similar way as Blender with the dithered colours?

Or is there another solution to this...? I can screen grab a single image from Blender which captures the dithering, save it as a bmp and it looks better in my app, but I need to do this for an animation and there are too many frames...

Any help to point me in the right direction would be really appreciated.

Arran

z3r0_d
Posts: 289
Joined: Wed Oct 16, 2002 2:38 am
Contact:

Post by z3r0_d »

it sounds like you're running at 16 bits per pixel [65 thousand colors?]... try opening your image in some application like the paint shop pro and converting it to 16 bit color before importing it into your app...
[then save as a bitmap or png, if you save as a jpeg it will be 24 bits again]

arrand
Posts: 0
Joined: Mon Jan 08, 2007 5:44 pm
Location: London UK

Post by arrand »

When I set Blender to output RGBA it saves it as 32bit colour, but the problem still occurs.

If I use the 'Dump Subwindow' option from the File menu it saves it exactly as it appears in the Blender window, i.e. with the dithering, and it looks fine in my app.

Using Dump would solve my problem (with some trimming of the image edges), but I can't see a way to render an animation and use the Dump Subwindow option to automatically save each of the frames. Perhaps this is possible with a script...?

Thanks
Arran

arrand
Posts: 0
Joined: Mon Jan 08, 2007 5:44 pm
Location: London UK

Post by arrand »

Yes I was running windows in 16-bit colour mode... doh!

The problem came because some apps, including Blender, automatically dither the image when converting a 32-bit image to a 16-bit display. The Windows image blitting functions I'm using seem to just get the nearest colour - which looks noticeably worse than dithering.
So, if 16-bit mode is to be supported by apps they need to dither Blender images in 16-mode for them to look ok.

Thanks
Arran

ititrx
Posts: 0
Joined: Sat Dec 30, 2006 10:53 pm

Are you using active x for your graphics?

Post by ititrx »

I dont think blender does, so perhaps there is that difference in the rendering engine?

Post Reply