03-07-2022, 12:51 PM | #1 |
Human being with feelings
Join Date: Apr 2018
Posts: 515
|
[Solved] Is Smooth Cropping Automation Possible
Hi, I am using a track envelop to try to smoothly crop and un-crop an image overlay. However, as the video plays, the overlay seems to zoom slightly in and out as well as moving up, down, left, right while the cropping happens.
I have tried a number of different presets posted on the forum, and have not found one that doesn't do this. Does anyone know of a preset that can be smoothly automated in this way? Is there some setting that I'm doing wrong? Thanks. Last edited by Sid; 03-12-2022 at 08:48 AM. |
03-07-2022, 05:41 PM | #2 | |
Human being with feelings
Join Date: Aug 2020
Location: Brasil
Posts: 679
|
Quote:
ex: gfx_blit(img, crx, cry, crw & 0xFFFE, crh & 0xFFFE) yes that strange "&0xFFFE" converts to even Hope this solves your problem. |
|
03-07-2022, 06:09 PM | #3 |
Human being with feelings
Join Date: Apr 2018
Posts: 515
|
That seems to be getting me close. In testing, I have found that if the image has a scale factor of 1 (not scaled up or down), it remains solidly in place. Any other scale factor allows for the errors. I will keep looking.
Thanks for your suggestion. |
03-08-2022, 04:32 AM | #4 | |
Human being with feelings
Join Date: Aug 2020
Location: Brasil
Posts: 679
|
Quote:
Code:
//Basic helpers: crop //by papagirafe //@param cl "crop left" 0 0 1 0.5 0.001 //@param cr "crop right" 0 0 1 0.5 0.001 //@param ct "crop top" 0 0 1 0.5 0.001 //@param cb "crop bottom" 0 0 1 0.5 0.001 E=0xFFFE; input_info(0,w,h); cl=(cl*w)&E;cr=(cr*w)&E;ct=(ct*h)&E;cb=(cb*h)&E; cx=cl;cy=ct; cw=w-(cl+cr);ch=h-(ct+cb); project_w=cw; project_h=ch; gfx_set(0,0,0,1,mode,-1); gfx_blit(0,1,0,0,cw,ch,cx,cy,cw,ch); Last edited by papagirafe; 05-07-2023 at 04:45 PM. Reason: parameter "use alpha" is useless |
|
03-08-2022, 11:41 AM | #5 |
Human being with feelings
Join Date: Apr 2018
Posts: 515
|
Thank you!
That creates a very smooth crop automation. As you suggested, it does cause the image to shift slightly leftward when cropping from the left, so that has to be automated back. But otherwise, very nice. |
03-08-2022, 01:09 PM | #6 |
Human being with feelings
Join Date: Aug 2020
Location: Brasil
Posts: 679
|
Great! One can easily create a variation on the preset that crops at a distance around a central point of choice.
|
Thread Tools | |
Display Modes | |
|
|