# How to control Bayer conversion in the code

**URL:** <https://forum.commonvisionblox.com/t/how-to-control-bayer-conversion-in-the-code/638>\
**Category:** .Net API\
**Tags:** bayertorgb\
**Created:** [January 3, 2019, 4:48pm UTC](https://forum.commonvisionblox.com/t/how-to-control-bayer-conversion-in-the-code/638 "2019-01-03T16:48:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![soultower](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@soultower](https://forum.commonvisionblox.com/u/soultower)\
**Post date:** [January 3, 2019, 4:48pm UTC](https://forum.commonvisionblox.com/t/how-to-control-bayer-conversion-in-the-code/638/1 "2019-01-03T16:48:42Z")

</div>

How to control Bayer conversion in the code? I want to use a high quality Bayer conversion (`RgbConversion.Linear`).  
I mean, can I change the conversion mode here? Or do I convert the image after I get it?

---

<div class="post-metadata">

**Author:** ![illusive](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/illusive/32/61_2.png) [@illusive](https://forum.commonvisionblox.com/u/illusive)\
**Post date:** [January 4, 2019, 8:04am UTC](https://forum.commonvisionblox.com/t/how-to-control-bayer-conversion-in-the-code/638/2 "2019-01-04T08:04:46Z")

</div>

The Bayer conversion accessible through `Stemmer.Cvb.Foundation.BayerConversion.ToRgb` (which makes use of the `RgbConversion` enum) needs to be applied to the image _after_ it was acquired. This conversion is superior in quality and more tunable in terms of patterns, white balance and interpolation mode than what the driver does internally, but also slightly more time-consuming.
