updated f_debayer and newly added f_imwrite