Convert tb_gpu_template and converttoimage to deal with packed address and RGB values