View Single Post
Old 07-11-2017, 11:46 AM   #1488
kawa_
Human being with feelings
 
kawa_'s Avatar
 
Join Date: Mar 2016
Posts: 117
Default

Hi, I have just wrote video processor script.
though this may be get unexpected result , this script could to crop video.

[screen shot]
https://stash.reaper.fm/31122/VideoP...rop_test01.gif
https://stash.reaper.fm/31123/VideoP...rop_test02.PNG

Code:
//Video Crop Test

//@param2:xPos  'offset X'   0 -1 1
//@param3:yPos  'offset Y'   0 -1 1
//@param5:cropX 'crop X'     0  0 1
//@param6:cropY 'crop Y'     0  0 1
//@param7:cropW 'crop w'     1  0 1
//@param8:cropH 'crop h'     1  0 1
//@param10:isCropType 'Mode' 0  0 1 0.5 1
//====================================================================
img1 = 0;
img2 = input_ismaster() ? -2 : input_track(0);
( img2 > img1 || input_count() == 0 || input_ismaster() )?
(
  img_w = 0;
  img_h = 0;
  gfx_img_info (img1,img_w,img_h);
  //==================================================================
  ( isCropType == 0 )?
  (
    src_x = floor( img_w * cropX);
    src_y = floor( img_h * cropY);
    src_w = floor( img_w * cropW );
    src_h = floor( img_h * cropH );
    
  ):(
    src_x = floor( img_w * cropX *0.5);
    src_y = floor( img_h * cropY *0.5);
    src_w = floor( (img_w -src_x) * cropW -src_x );
    src_h = floor( (img_h -src_y) * cropH -src_y );
  );
  //==================================================================
  dest_x = floor(src_x + project_w *xPos);
  dest_y = floor(src_y + project_h *yPos);
  dest_w = src_w;
  dest_h = src_h;
  
  gfx_blit( img2
          , 0); // aspect
  
  gfx_dest = -1;
  gfx_blit( img1
          , 0 // aspect
          , dest_x , dest_y
          , dest_w , dest_h
          , src_x  , src_y
          , src_w  , src_h
          );           
);
__________________
web | kawaScripts | donate | twitter |

Last edited by kawa_; 07-11-2017 at 11:52 AM.
kawa_ is offline   Reply With Quote