Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Why is "BaseBitmap.__getitem__" bmp(x,y) only 8Bit

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 290 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 02/03/2014 at 06:50, xxxxxxxx wrote:

      Why is "BaseBitmap.__getitem__" bmp(x,y) only 8Bit?

      It seems strange hence all the other color Values are more than enough but the bmp functions can only output 8bit values?

      Perhaps I am on the wrong track, i need to read the pixel color of a rendered image to check against a color setting made in c4d.

      How do i read the rendering in 16bit instead of 8bit?

      From the SDK:
      _Example:
      r, g, b = bmp[5, 5] #returns the color of a pixel at position x(5), y(5)

      Return type:     tuple(int, int, int)
      Returns:     The color of a pixel. Range between 0-255._ <-----!!!

      Can it be converted to a C4D Vector with full color spectrum ? I guess I'll lose accuracy?

      confused ...
      ???

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 02/03/2014 at 13:05, xxxxxxxx wrote:

        ah found something

        (to use higher bit depths or multiple channels, see MultipassBitmap).

        but how do i read the color values of each pixel of a multipass image?

        kind regards
        mogh

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 04/03/2014 at 11:34, xxxxxxxx wrote:

          So I managed to read my BMP with this:

          http://www.maxonexchange.de/sdk/CINEMA4DPYTHONSDK/help/modules/c4d.bitmaps/BaseBitmap/index.html#BaseBitmap.SetPixelCnt

          especially this part of the script:
              Example: RGB value of first pixel (only for 32 bits)
              import struct
              r, g, b = struct.unpack("fff", sq[0:12])
              print r, g, b

          but I get strange RGB Values of my 32Bit Image.

          I set the Object to RGB Float Values and get these float values from my 32Bit Pixels.

          Testcolor: Vector(0.1, 0.2, 0.3) -> 32Bit RGB: 0.0100228255615 0.0331047661602 0.0732389613986
          Testcolor: Vector(0.4, 0.5, 0.6) -> 32Bit RGB: 0.13286831975   0.214041143656 0.318546801805
          Testcolor: Vector(0.7, 0.8, 0.9) -> 32Bit RGB: 0.447988420725 0.603827357292 0.7874122262
          Testcolor: Vector(0.99,0.999, 1) -> 32Bit RGB: 0.977401912212 0.997726678848 1.0

          This has a strange dynamic and I can't tell how to convert my values back so I can compare them.

          My Questions:

          What type of (RGB) values gives me the 32Bit Pixel`
          How do I convert them to a format similar to the editor RGB Values which seem to be floats in percentage with 5 digits e.g "45.123%" ?

          Cinema R13 Studio

          kind regards
          mogh

          1 Reply Last reply Reply Quote 0
          • First post
            Last post