Python Bug - RenderDocument results in black Image

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 24/03/2011 at 06:56, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R12 
Platform:     Mac  ;  
Language(s) :

---------
Hey guys,

just started learning Python and stumbled on a problem what is apparently a bug. When I render the image with my script and show it in the picture viewer, the resulting image is just black.

Here's the script I use:

import c4d
from c4d import bitmaps, documents
  
doc = documents.GetActiveDocument()
rd = doc.GetActiveRenderData().GetData()
  
res_x = 512	# image resolution x
res_y = 512	# image resolution y
bitdepth = 8 # image depth
  
bmp = bitmaps.BaseBitmap()
bmp.Init(x=res_x, y=res_y, depth=bitdepth)
  
documents.RenderDocument(doc, rd, bmp, c4d.RENDERFLAGS_EXTERNAL)
bitmaps.ShowBitmap(bmp)

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 24/03/2011 at 10:23, xxxxxxxx wrote:

Hi pelZ,

The bit depth in your code is not correct.

Cheers, Sebastian

bitdepth = 24 # image depth

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 24/03/2011 at 11:56, xxxxxxxx wrote:

Originally posted by xxxxxxxx

Hi pelZ,

The bit depth in your code is not correct.

Cheers, Sebastian

bitdepth = 24 # image depth

Hi Sebastian,

that fixes the problem. Thanks! 
But why is it 24 (16 and 32 seem to work as well)?

Ciao,
Philipp

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 24/03/2011 at 16:59, xxxxxxxx wrote:

16 bit works fine as well but the image has a lower quality.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 24/03/2011 at 22:38, xxxxxxxx wrote:

When you render an Image "with 8 Bit" it is 8 Bit per Channel, not the overall bitdepth.

There are 3 Channels. (RGB)
3 * 8 = 24

With Alpha, there are 4 Channels.
4 * 8 = 32

Higher Bitdepths per Channel:
4 * 32 = 128

Cheers, nux