struct

(** Scale the given image at the given size (width,height). @return a new image *)

let scaleTo (width,height) pixbuf = 
  begin
  let scaled = GdkPixbuf.create ~has_alpha:true ~width ~height () in
(*  GdkPixbuf.scale ~dest:scaled ~width ~height ~interp:`BILINEAR pixbuf; *)
  GdkPixbuf.scale ~dest:scaled ~width ~height ~interp:`HYPER pixbuf; 
  scaled
  end
;;

(** Make a zoom of the given image with the given factor (>1 => zoom IN, <1 => zoom OUT). @return a new image *)

let zoom (factor:float) pixbuf = 
  let formule = (fun x -> (float_of_int  x)  *. factor +. 0.5 ) || int_of_float in 
  let width  = pixbuf => (GdkPixbuf.get_width  || formule) in
  let height = pixbuf => (GdkPixbuf.get_height || formule) in 
  prerr_endline ("Old width="^(string_of_int (GdkPixbuf.get_width pixbuf)));
  prerr_endline ("Old height="^(string_of_int (GdkPixbuf.get_height pixbuf))^"\n");
  scaleTo (width,height) pixbuf
;;

(** The pixels to inch conversion: ppi stands for pixel-per-inch *)

let inch_of_pixels ?(ppi=96.) (x:int) = (float_of_int x) /. ppi ;;

end