you just pointed out problem. BMP use 24 bit per pixel. so you must reorganize data from 3 bytes/pixel to 4 bytes/pixel. and just warn you uchar3 and other three component vector types have same size as 4 component. so it doesn't help change it to three component vector type.