diff options
| author | scuri <scuri> | 2009-08-21 19:14:34 +0000 | 
|---|---|---|
| committer | scuri <scuri> | 2009-08-21 19:14:34 +0000 | 
| commit | 0ab3aef31d7820f40bb22e15bba930f923f8bf72 (patch) | |
| tree | 3339909882765517adf0236cbbe6358193e322df /html/examples | |
| parent | c25969a20a617c4537fc2a403d1942bfb984ed4b (diff) | |
*** empty log message ***
Diffstat (limited to 'html/examples')
| -rw-r--r-- | html/examples/multicrop_avi.lua | 73 | ||||
| -rw-r--r-- | html/examples/multicrop_gif.lua | 2 | 
2 files changed, 74 insertions, 1 deletions
| diff --git a/html/examples/multicrop_avi.lua b/html/examples/multicrop_avi.lua new file mode 100644 index 0000000..fa6593f --- /dev/null +++ b/html/examples/multicrop_avi.lua @@ -0,0 +1,73 @@ +-- lua multicrop_avi.lua 60 60 0 0 newfile.avi DSC003*.jpg + +require"imlua" +require"imlua_process" +require"imlua_avi" + +err_msg = { +  "No error.", +  "Error while opening the file.", +  "Error while accessing the file.", +  "Invalid or unrecognized file format.", +  "Invalid or unsupported data.", +  "Invalid or unsupported compression.", +  "Insuficient memory", +  "Interrupted by the counter", +} + +-- Margin parameters +x1 = arg[1] +x2 = arg[2] +y1 = arg[3] +y2 = arg[4] +new_filename = arg[5] +filename1 = arg[6] +if (not x1 or not x2 or not y1 or not y2 or not new_filename or not filename1) then +  print("Must have the rectangle coordinates and at least one file name as parameters.") +  print("  Can have more than one file name as parameters and can use wildcards.") +  print("  Usage:") +  print("    lua multicrop_avi.lua x1 x2 y1 y2 new_filename filename1 filename2 ...") +  return +end + +print(">>> Crop of multiple images <<<") + +function ProcessImageFile(file_name, ifile) +  print("Loading File: "..file_name) +  local image, err = im.FileImageLoad(file_name); +  if (err and err ~= im.ERR_NONE) then +    error(err_msg[err+1]) +  end + +  local new_image = im.ProcessCropNew(image, x1, image:Width()-1-x2, y1, image:Height()-1-y2) +  ifile:SaveImage(new_image) + +  new_image:Destroy() +  image:Destroy() +end + +ifile = im.FileNew(new_filename, "AVI") +--ifile:SetInfo("MP42") -- Microsoft MPEG-4 Video Codec V2 +--ifile:SetInfo("DIVX") -- DivX must be installed +ifile:SetInfo("CUSTOM") -- show compression dialog  +                        -- (once you choosed the compression that give the best results  +                        --  you can then edit the script and hardcode it) + +ifile:SetAttribute("FPS", im.FLOAT, {15}) -- Frames per second +--ifile:SetAttribute("AVIQuality", im.INT, {-1}) -- Default Quality + + +file_count = 0 +for index,value in ipairs(arg) do +  if (index > 5) then +    ProcessImageFile(arg[index], ifile) +    file_count = file_count + 1 +  end +end + +ifile:Close() + +if (file_count > 1) then +  print("Processed "..file_count.." Files.") +end +print("Saved File: "..new_filename) diff --git a/html/examples/multicrop_gif.lua b/html/examples/multicrop_gif.lua index 0a519d3..5cf85a0 100644 --- a/html/examples/multicrop_gif.lua +++ b/html/examples/multicrop_gif.lua @@ -25,7 +25,7 @@ if (not x1 or not x2 or not y1 or not y2 or not new_filename or not filename1) t    print("Must have the rectangle coordinates and at least one file name as parameters.")    print("  Can have more than one file name as parameters and can use wildcards.")    print("  Usage:") -  print("    lua multicrop.lua x1 x2 y1 y2 new_filename filename1 filename2 ...") +  print("    lua multicrop_gif.lua x1 x2 y1 y2 new_filename filename1 filename2 ...")    return  end | 
