ios - How do I convert bitmap format of a UIImage? -


i need convert bitmap normal camera format of kcvpixelformattype_32bgra kcvpixelformattype_24rgb format can consumed 3rd party library.

how can done?

my c# code looks in effort of doing directly byte data:

byte[] sourcebytes = uiimagetransformations.bytesfromimage(sourceimage); // final source rgb byte[] finalbytes = new byte[(int)(sourcebytes.length * .75)]; int length = sourcebytes.length; int finalbyte = 0; (int = 0; < length; += 4)  {     byte blue = sourcebytes[i];     byte green = sourcebytes[i + 1];     byte red = sourcebytes[i + 2];      finalbytes[finalbyte] = red;     finalbytes[finalbyte + 1] = green;     finalbytes[finalbyte + 2] = blue;     finalbyte += 3; }  uiimage finalimage = uiimagetransformations.imagefrombytes(finalbytes); 

however i'm finding sourcebytes length not divisible 4 doesn't make sense me.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -