Title / Description
Code size_t oldByteSize = width * height * 2; //gray alpha size_t byteSize = width * height * 4; //rgba uint8_t* newData = (uint8_t*)malloc(byteSize); size_t i = 0, j = 0; for(; i < oldByteSize; i+=2, j+=4) { newData[0 + j] = data[i]; newData[1 + j] = data[i]; newData[2 + j] = data[i]; newData[3 + j] = data[i+1]; }
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code