let image_params ?(img_hook=fun s -> s) (error_msg:Error.message -> unit) =
let parse_options str =
(* let l = String.length l in *)
(* if str.[l - 1] = '%' then ( *)
try
begin try Scanf.sscanf str "%dpx" (fun w -> `wpx w)
with _ -> Scanf.sscanf str "%d%%" (fun w -> `wpercent w)
end
with _ -> error_msg (`bad_size_specification_in_image str); `none
in
function
| [] -> ("", (`none :Stack.image_size) , "")
| [s] -> (img_hook s, `none, "")
| s :: o :: [] -> (img_hook s, parse_options o, "")
| s :: o :: l :: t -> (img_hook s, parse_options o, l)