__SQL_GET_STRING(image_format,"select format from co_%s_picture
where id=%d",par_area,par_id)
// can convert only from bmp format
if ((!strcmp(image_format,"bmp")) && (strcmp(new_format,"bmp")))
{
@co_call(par_area,par_class,'getPath',par_id=>par_id,par_area=>par_area,par_class=>par_class);
partial_path = cou_getReturnValue( cnx, CO_STRING, &err);
source_file_path = ap_psprintf( p, "%s/%s", cou_getCODataPath(), partial_path);
destination_file_path = ap_psprintf( p, "/tmp/picture.%d", par_id);
bash_command = ap_psprintf(p,"%stoppm %s | ppmto%s > %s",image_format,source_file_path,new_format,destination_file_path);
__SEND_MESG_DEBUG("bash_command = %s",bash_command)
system(bash_command);
rename(destination_file_path,source_file_path);
__CREATE_QUERY("update co_%s_picture set format='%s'
where id=%d",par_area,new_format,par_id)
__SQL_EXEC
}