Log in

View Full Version : Auto Resize: Keep Aspect Ratio w/ AddBorder


mikeytown2
26th February 2008, 05:28
This will resize the source keeping the aspect ratio, by adding a border when needed. Useful for resizing material before it's uploaded to youtube, ect...

# ResizeKAR() - May 8th, 2008
# Resize the source keeping the aspect ratio, by adding a border when needed.
#
# Input:
# clip c: input clip.
# int width: output width
# int height: output height
# Optional:
# string ResizeMethod: Default(BilinearResize)
# int BackgroundColor: Default($000000)
# bool NoBorders: Resizes without adding borders. Default(False)
#
# Notes:
# Respects ColorSpace Restrictions

function ResizeKAR(clip c, int width, int height, string "ResizeMethod", int "BackgroundColor", bool "NoBorders")
{
BackgroundColor = Default(BackgroundColor, $000000)
ResizeMethod = Default(ResizeMethod, "BilinearResize")
NoBorders = Default(NoBorders, False)

ratioS = Float(width(c))/Float(height(c))
ratioD = Float(width)/Float(height)
newW = Round(height*ratioS/2)*2
newH = Round(width/ratioS/2)*2

BorderH = (NoBorders==True) ? 0 : Round((height-newH)/2)
BorderW = (NoBorders==True) ? 0 : Round((width-newW)/2)

#Dest Higher Then Source; Dest Wider Then Source; Same Ratio
c =
\ (ratioS>ratioD) ?
\ Eval(ResizeMethod + "(c, " + String(width) + ", " + String(newH) + ")").
\ AddBorders(0, BorderH, 0, BorderH, BackgroundColor) :
\ (ratioS<ratioD) ?
\ Eval(ResizeMethod + "(c, " + String(newW) + ", " + String(height) + ")").
\ AddBorders(BorderW, 0, BorderW, 0, BackgroundColor) :
\ (ratioS==ratioD) ?
\ Eval(ResizeMethod + "(c, " + String(width) + ", " + String(height) + ")" ) :
\ nop()

#fix 1px changes, works only with 4:4:4
c =
\ (IsRGB(c)) && (width>width(c)) && (NoBorders==false) ? c.AddBorders(0, 0, 1, 0) :
\ (IsRGB(c)) && (height>height(c)) && (NoBorders==false) ? c.AddBorders(0, 0, 0, 1) :
\ c
return c
}



Example:

ColorBars().ResizeKAR(730, 488, "BlackmanResize")


Comments:
Adding borders with a width of 1px top/bot or left/right (total of 2px) doesn't happen correctly if video source is not RGB (4:4:4). Border sizes with a multiple of 4px always work. Shrinking the clip could be done better, i think. Overall this works very well, just pointing out some very minor issues.

Future Ideas:

Add width & height error checking.
Crop video instead of adding borders to keep the aspect ratio.
Pass optional parameters to resizer function (taps, p, b, c, ect...).


EDIT
March 4th, 2008: Code Rewrite. Code is cleaner, added option to pass your own resizer to the function, 1px border fix
May 8th, 2008: Added the no border option. Added header to function.


Use Of ZoomBox (http://forum.doom9.org/showthread.php?p=1138231#post1138231) is recommended instead of ResizeKAR

Sharc
10th May 2008, 09:42
Thanks, very useful.
Is it available as an avisynth plugin?

mikeytown2
10th May 2008, 10:07
Thanks, very useful.
Is it available as an avisynth plugin?

No but... What i do is put this function in an .avsi file. The i at the end of avs makes it autoload if you place this in your plugin dir. On my computer that dir is here
C:\Program Files\AviSynth 2.5\plugins

Hope this helps!

http://avisynth.org/mediawiki/Import (see note 2 at bottom)

Sharc
10th May 2008, 17:30
Thanks!

gzarkadas
10th May 2008, 20:16
...
Future Ideas:

Add width & height error checking.
Crop video instead of adding borders to keep the aspect ratio.
Pass optional parameters to resizer function (taps, p, b, c, ect...).

...


Just to save your time, all of these have been done before (and will be made C++ plugins in my next release); see the ResizeToTarget (http://avslib.sourceforge.net/functions/r/resizetotarget.html) function, part of the AVSLib filters package (http://avslib.sourceforge.net/packages/filters/index.html).
This is just a productivity-enhancement tip :); you control your time, of course.

mikeytown2
11th May 2008, 02:44
gzarkadas, could you give an example on how to use one of these avslib functions, in order to replicate my ResizeKAR?
http://avslib.sourceforge.net/packages/filters/resize.html

45tripp
13th May 2008, 00:07
gzarkadas, could you give an example on how to use one of these avslib functions, in order to replicate my ResizeKAR?
http://avslib.sourceforge.net/packages/filters/resize.html

yes please,
as i understand, you need a target clip, so to do what resizekar() wants to do you'd have to create a dummy target clip?

This will resize the source keeping the aspect ratio, by adding a border when needed. Useful for resizing material before it's uploaded to youtube, ect...

well, only for square grid pixel sources,
in which case the manual calculation is trivial.

i'd consider adding a dar setting.

also,
'noborders' is fairly useless,
autoscaling to either the horizontal or vertical setting.
if i want to scale to a set width or height, i'd like to do just that.

mikeytown2
13th May 2008, 00:20
i'd consider adding a dar setting.

also,
'noborders' is fairly useless,
autoscaling to either the horizontal or vertical setting.
if i want to scale to a set width or height, i'd like to do just that.

DAR would be nice, i'm going to wait for a reply, see if AVSLib will take care of it. The no border option isn't completely useless, i made that for this script of mine.
http://forum.doom9.org/showthread.php?t=137534

gzarkadas
13th May 2008, 21:07
Hi,
I stumbled upon a bug on this one :devil:, but again this was good because I found it :). The intended behavior for ResizeToFit is for the two calls below (see example code):

LoadModule("avslib", "filters", "resize")
last = ...whatever source...400x400
c1 = last.ResizeToFit(720, 480, RTF_ZOOM, "LanczosResize")
c2 = last.ResizeToFit(720, 480, RTF_CROP, "LanczosResize")

to get in c1 a 480x480 resized clip at the middle of a black 720x480 clip and in c2 a cropped (top-bottom in this case) 720x480 clip. The action on c1 is what ResizeKAR currently does with: c1 = last.ResizeKAR(720, 480, "LanczosResize")

The crop mode works ok, however in the zoom mode there is an error in line 174 of resize.avsi, inside the internal __resize_tofit_zoom function. In this line, the c variable:

: Overlay(c, rsz, x=r1w, y=r1h, mode="blend", opacity=1.0) \
must be changed to black to get things work as intended. I believe this answers to the questions in the last 3 posts; you can test it for yourselves if you like, as well as the optional parameters to avisynth resizers (rsz_param1 for the 1st, ...2 for the 2nd; as many as they accept), but I don't want to go further - it's not my thread here...

mikeytown2
16th May 2008, 01:36
i'd consider adding a dar setting.


This is interesting... My ZoomBox (http://forum.doom9.org/showthread.php?p=1111789#post1111789) Function now can do this. It's higher quality then ResizeKAR so i would recommend ZoomBox (http://forum.doom9.org/showthread.php?p=1111789#post1111789) over resizeKAR now! It also allows you to add borders or crop.

For the examples below, I'm going to use my HDV camera. It Records to 1440x1080 (PAR), but it plays back at 1920x1080 (DAR).

Original Image:
http://img136.imageshack.us/img136/5083/1920x1080smptecolorbarsea8.th.png (http://img136.imageshack.us/my.php?image=1920x1080smptecolorbarsea8.png)
Image Used:
http://img76.imageshack.us/img76/5601/1080x1440widescreenhl3.th.png (http://img76.imageshack.us/my.php?image=1080x1440widescreenhl3.png)
http://en.wikipedia.org/wiki/SMPTE_color_bars



#change the OutputWidth and OutputHeight and see how the final clip changes.
OutputWidth=720
OutputHeight=480
#compare different resize methods
Resize = "BlackmanResize"

# 1000 frames long clip with a PAR of 1440x1080, Crop to Fit. Target is square pixels
ImageReader("1080x1440widescreenhl3.png",0,0)
ZoomBox(OutputWidth, OutputHeight, ResizeMethod=Resize, DisplayAR=1920.0/1080.0, Align=5)
AssumeFPS("ntsc_video").Loop(1000)




#change the OutputWidth and OutputHeight and see how the final clip changes.
OutputWidth=720
OutputHeight=480
#compare different resize methods
Resize = "BlackmanResize"

# 1000 frames long clip with a PAR of 1440x1080, Add Borders to Fit. Target is square pixels
ImageReader("1080x1440widescreenhl3.png",0,0)
ZoomBox(OutputWidth, OutputHeight, ResizeMethod=Resize, DisplayAR=1920.0/1080.0, Align=-5)
AssumeFPS("ntsc_video").Loop(1000)




#change the OutputWidth and OutputHeight and see how the final clip changes.
OutputWidth=720
OutputHeight=480
#compare different resize methods
Resize = "BlackmanResize"

# 1000 frames long clip with a PAR of 1440x1080, Add Borders to Fit. Target is square pixels
ImageReader("1080x1440widescreenhl3.png",0,0)
SeparateFields().SelectEven() #fast deinterlacer
ZoomBox(OutputWidth, OutputHeight, ResizeMethod=Resize, DisplayAR=1920.0/1080.0, Align=-5)
AssumeFPS("ntsc_video").Loop(1000)




Footnotes:
http://www.doom9.org/index.html?/aspectratios.htm
http://en.wikipedia.org/wiki/Pixel_aspect_ratio

45tripp
5th June 2008, 18:02
hi,
had time to try

they're all wrong.

first off,
the usage of the term DisplayAR is wrong,
as that's not what your variable is.
it's more akin to Sample aspect ratio, but not that either.
i'd say it's sample aspect ratio of target as required by defined box.
something like that.
anyway terminology is wrong.

so with terminology wrong, usage is wrong too.

for the above examples, setting DisplayAR to 1.5 is correct.
and the call to bilinearresize is useless as it's overriden by DisplayAR. (aspect wise, and harmful elsewise)

the approach is also wrong conceptually wise.
as it forces more calculations than a manual approach would.

as an example of a 16/9 720x480 resize to 4/3 720x480
ZoomBox(720, 480, ResizeMethod="lanczosResize", DisplayAR=2, Align=-5)
ZoomBox(720, 480, ResizeMethod="lanczosResize", DisplayAR=2, Align=5)
and of a 4/3 720x480 resize to 16/9 720x480
ZoomBox(720, 480, ResizeMethod="lanczosResize", DisplayAR=1.125, Align=-5)
ZoomBox(720, 480, ResizeMethod="lanczosResize", DisplayAR=1.125, Align=5)
as you can see i had to calculate as i would manually,
and then further plug the SARwithinbox.
I like the way +/- switches between padding and 'cropping' though.

What i'd envisioned when i mentioned dar was related to this:

Originally Posted by mikeytown2
This will resize the source keeping the aspect ratio, by adding a border when needed.
Useful for resizing material before it's uploaded to youtube, ect...
in which case what you'd need is a displayAR variable of the input material.
to handle DV, DVD -> square pixel target.
so you'd need DAr=4/3, 16/9, or whatever, with default being source DAR=SAR.

of course working on something more complex like having inputs for both source DAR and target DAR would be welcome.


I also looked at the last examples you set in the kenburns thread.
I prefer to keep life simple with digital computations,
but being able to automatically do resizing based in the paper referenced would be a good bonus.

your examples there all look correct,
they still suffer from terminology+ issues i've already mentioned here.
and i think h. in the pal example is meant to like so:
h=BilinearResize(712,486).crop(0,3,0,-3).addborders(4,0,4,0)
also, of course, all computations should be internal to the function, which i realise they aren't because it's just a test.

ty

mikeytown2
5th June 2008, 22:04
Immersion, thanks for your input! For the example, 2 posts up from here, I needed a picture that didn't have square pixels, thus i used BilinearResize to do it. This wasn't 100% clear, so I uploaded the picture without square pixels, in order to give a better example, and changed the code. I agree that the "DisplayAR" terminology is wrong. It is more like an aspect ratio modifier. You can use it to correct the aspect ratio for the source and/or destination/target. I agree that when correcting for the destination/target AR, it requires more math, mainly because I was using my "DisplayAR" to correct for my HDV cam's non square pixels; so when correcting the source AR it's simple. Having inputs for both source DAR and target DAR could be done, but I need to know the math; internally it would have to convert the 2 inputs into 1 ratio.

Also would you mind posting the math on how you came up with 2 and 1.125, and give an example on how to do it the usual way since you posted how to do it using my code. Converting for target AR is something I rarely do.
Thanks for your time!

Wilbert
5th June 2008, 22:19
in which case what you'd need is a displayAR variable of the input material.
to handle DV, DVD -> square pixel target.
so you'd need DAr=4/3, 16/9, or whatever, with default being source DAR=SAR.

I suggest that you guys stick with common terminology. When referring to SAR, people usually mean it to be _Sample Aspect Ratio_ which equals 1/PAR.

45tripp
6th June 2008, 00:29
For the example, 2 posts up from here, I needed a picture that didn't have square pixels, thus i used BilinearResize to do it. This wasn't 100% clear,

it's clear to me what you were doing.
i was pointing out, aspect wise, it was useless.
you could have resized to anything, and (picture quality aside)
by setting displayAR, the result would be the same.

the examples are still wrong.
you still need to set dispalayAR to 1.5.
i'm assuming you're resizing to 720,480 with 29.97 fps as a dvd target.
A safe assumption i think.
otherwise if it were an arbitrary box, you should have selected something a bit more, well, arbitrary.

here a simple
lanczosresize(720,480)
is correct

in a final function it should be equally simple as
zoombox(720,480)
as source dar = target dar


Having inputs for both source DAR and target DAR could be done, but I need to know the math; internally it would have to convert the 2 inputs into 1 ratio.

yeah, a good idea.
the math shouldn't take long, once the approach is decided.


Also would you mind posting the math on how you came up with 2 and 1.125, and give an example on how to do it the usual way since you posted how to do it using my code.

16/9 to 4/3
720x480 with 4/3 dar -> 640x480,
actual width/1.778 = 360
so for your 16/9 image sit in the 4/3 image you need
active image = 720x360 with vertical padding up to 480.
720/360=2

4/3 to 16/9
720x480 with 16/9 dar -> 843x480,
actual height*1.333 = 640
640/1.185(16/9 PAR)=540
so for your 4/3 image sit in the 16/9 image you need
active image = 540x480 with horizontal padding up to 720.
540/480=1.125

these are working on placing the image within the box with padding, to fit your model.
there are also the crop methods. which are nicely achieved in your model by simply setting align to 5 instead of -5,
but calculations have to be done based on -5 within the defined box.

i don't know,
maybe my explanation is a bit convoluted.
it's correct though.

I suggest that you guys stick with common terminology. When referring to SAR, people usually mean it to be _Sample Aspect Ratio_ which equals 1/PAR.

i've never seen that definition.
i've seen SAR referred to as an alternate naming for PAR,
but never to mean it's inverse.

i take cue from gspot, and others, in taking sample/storage aspect ratio to mean the storage frame size ratio,
so that
SAR x PAR = DAR
[720/480=1.5] x 1.185 = [16/9=1.778]

if you have some other definition for me,
i'll use it.

ty

mikeytown2
6th June 2008, 04:39
Made a function that is tuned to sourceDAR=4/3 & targetDAR=16/9. This function needs to be more general. So right now the Destination Width and Height can be anything, the source DAR and target DAR are locked down. Eventually all variables should be changeable, and have it produce the correct image. Any help would be much appreciated. You can change the targetDAR without much thought (will give incorrect results), changing of the sourceDAR requires redrawing the square.


#Draw a black square
BlankClip(1,640,480, color=$FFFFFF)
a = Overlay(BlankClip(1,240,240),200, 120)

Modify(a, 720,480)
last + Modify(a, 640,480)
last + Modify(a, 480,480)
last + Modify(a, 320,480)
last + Modify(a, 720,320)
last + Modify(a, 720,240)
last + Modify(a, 720,120)
last + Modify(a, 853,480)


Function Modify(clip c, int W, int H)
{
c
SourceDAR=4.0/3.0
TargetDAR=16.0/9.0

ModAR = (1.0/(TargetDAR/(W/((H*SourceDAR)/TargetDAR))))
ModAR = W/(H*SourceDAR) #same as above

zoomBox(width=W, height=H, ResizeMethod="BilinearResize", DisplayAR=ModAR, Align=-5)
Subtitle(String(ModAR))

#DVD Player will resize so it plays back at 16/9
BilinearResize(Round(480*TargetDAR),480)

#overlay a red square so its easy to check for correct AR
Overlay(BlankClip(1,236,236, color=$FF0000),Round((480*TargetDAR-236)/2.0), 122)
}

mikeytown2
6th June 2008, 07:37
Thank God for my TI83's stat button... I got it. Here is the magical code


ModAR = SourceDAR*(float(W)/float(H))/TargetDAR


Here's my huge test function

#Draw a black square
BlankClip(1,640,480, color=$FFFFFF)
a = Overlay(BlankClip(1,240,240),200, 120).KillAudio().AssumeFPS(24).ConvertToRGB32()

Global SourceDAR=4.0/3.0
Test2(a)
b = ImageReader("traingr4.jpg",0,0).ConvertToRGB32().AssumeFPS(24)
Global SourceDAR=16.0/9.0
last + Test2(b)

Function Test2(clip a)
{
Test(a, 5.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 6.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 7.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 8.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 9.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 10.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 11.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 12.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 13.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 14.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 15.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 16.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 17.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 18.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 19.0/9.0).ZoomBox(800,600, align=-5)
last + Test(a, 20.0/9.0).ZoomBox(800,600, align=-5)
}

Function Test(clip a, float TargetDAR)
{
Modify(a, 853,480,TargetDAR)
last + Modify(a, 720,480,TargetDAR)
last + Modify(a, 640,480,TargetDAR)
last + Modify(a, 480,480,TargetDAR)
last + Modify(a, 320,480,TargetDAR)
last + Modify(a, 240,480,TargetDAR)

last + Modify(a, 720,800,TargetDAR)
last + Modify(a, 720,720,TargetDAR)
last + Modify(a, 720,640,TargetDAR)
last + Modify(a, 720,480,TargetDAR)
last + Modify(a, 720,320,TargetDAR)
last + Modify(a, 720,240,TargetDAR)
last + Modify(a, 720,120,TargetDAR)

last + Modify(a, 640,320,TargetDAR)
last + Modify(a, 480,360,TargetDAR)
last + Modify(a, 640,640,TargetDAR)
}



Function Modify(clip c, int W, int H, float TargetDAR)
{
c



ModAR = SourceDAR*(float(W)/float(H))/TargetDAR


zoomBox(width=W, height=H, ResizeMethod="BilinearResize", DisplayAR=ModAR, Align=-5)
#Subtitle(" ModAR=" + String(ModAR) + " width=" + String(W) + " height=" + String(H))

#DVD Player will resize so it plays back at 16/9
BilinearResize(Round(480*TargetDAR),480)

#overlay a red square so its easy to check for correct AR
Overlay(BlankClip(1,236,236, color=$FF0000),Round((480*TargetDAR-236)/2.0), 122, opacity=.8)
}

http://img355.imageshack.us/img355/2955/traingr4.th.jpg (http://img355.imageshack.us/my.php?image=traingr4.jpg)

Let me know what you think. The Red square is there to help with checking for squareness, it doesn't work correctly if the TargetDAR<1, but it still aids in checking the shape.

Wilbert
6th June 2008, 09:49
i've never seen that definition.
i've seen SAR referred to as an alternate naming for PAR,
but never to mean it's inverse.

i take cue from gspot, and others, in taking sample/storage aspect ratio to mean the storage frame size ratio,
so that
SAR x PAR = DAR
[720/480=1.5] x 1.185 = [16/9=1.778]

if you have some other definition for me,
i'll use it.
Well, Sample Aspect Ratio is not the same as Storage Aspect Ratio:
http://forum.doom9.org/showthread.php?p=685658#post685658
http://forum.doom9.org/showthread.php?p=686958#post686958

So i would use a different abbreviation for storage aspect ratio.

45tripp
6th June 2008, 19:10
Thank God for my TI83's stat button... I got it. Here is the magical code

very nice!
i was thinking more along the lines of fixing both terminology and function of displaydar in zoombox,
but whatever works.


Here's my huge test function

yes, it's a huge hog.
nice effect,
doesn't really demonstrate well practical use, i think.

i tried it and it seems to work with everything.

so,
something along these lines:

Function Modify(clip c, int W, int H, float "SDAR", float "TDAR", string "Rz", int "A", int "color")
{
c
SDAR = Default(SDAR, Float(c.width())/Float(c.height()))
TDAR = Default(TDAR, Float(W)/Float(H))
A = Default(A, -5)
color = default(color, $000000)
Rz = default(Rz, "lanczosresize")

ModAR = SDAR*Pow(float(W)/float(H),1)*Pow(TDAR,-1)


zoomBox(width=W, height=H, ResizeMethod=Rz, DisplayAR=ModAR, Align=A, color=color)


}

with align -5/5 perhaps being set as mode=pad/crop.
and how do make it so:
if Sdar AND Tdar are not user defined, THEN
set Sdar=Tdar
?

Well, Sample Aspect Ratio is not the same as Storage Aspect Ratio:
http://forum.doom9.org/showthread.php?p=685658#post685658
http://forum.doom9.org/showthread.php?p=686958#post686958

So i would use a different abbreviation for storage aspect ratio.

well i don't see much agreeance there ;)
I'm siding with seemoredigital, and gspot,
but i guess i could use StAR as symbol for storage aspect ratio.

ty mikeytown2

mikeytown2
6th June 2008, 23:18
i was thinking more along the lines of fixing both terminology and function of displaydar in zoombox.


Thats what i was thinking too :). I like to test code before I change the first post over there (http://forum.doom9.org/showthread.php?t=135776); I was just waiting for a thumbs up. ZoomBox has been updated. Thanks for critiquing my functions.

45tripp
7th June 2008, 01:15
Thats what i was thinking too :). I like to test code before I change the first post over there (http://forum.doom9.org/showthread.php?t=135776); I was just waiting for a thumbs up. ZoomBox has been updated. Thanks for critiquing my functions.

thanks for the update.


if Sdar AND Tdar are not user defined, THEN
set Sdar=Tdar


any chance of this?

any plans to incorporate the analogue calculations you made an exmaple of using the pars from the paper referenced?

mikeytown2
7th June 2008, 02:08
if Sdar AND Tdar are not user defined, THEN
set Sdar=Tdar. any chance of this?
What is the advantage of doing this, when would this be useful? I don't see an example of needing this. Help me understand why this is needed.



any plans to incorporate the analogue calculations you made an example of using the pars from the paper referenced?

By paper do you mean the wikipedia article on PAR (http://en.wikipedia.org/wiki/Pixel_aspect_ratio) or in my KBE thread where i referenced this conversion table (http://lipas.uwasa.fi/~f76998/video/conversion/#conversion_table).

I'm assuming that you mean making these values work with my function. I think "actual active picture size" in the second link is what is needed.

45tripp
7th June 2008, 17:21
What is the advantage of doing this, when would this be useful? I don't see an example of needing this. Help me understand why this is needed.


:)
well the example in this thread for one. (i guess you could edit it to reflect the change in zoombox)
resizing 1440x1080 to 720x480
with zoombox(720,480)
instead of zoombox(720,480, SourceDAR=16.0/9.0, TargetDAR=16.0/9.0)

i'd been focusing on that mostly, so it seemed like a good idea at first to have zoombox act as a regular resizer unless either, or both of the DAR values were manually set.

but i guess one could just call a regular resizer in that case.


By paper do you mean the wikipedia article on PAR (http://en.wikipedia.org/wiki/Pixel_aspect_ratio) or in my KBE thread where i referenced this conversion table (http://lipas.uwasa.fi/~f76998/video/conversion/#conversion_table).

I'm assuming that you mean making these values work with my function. I think "actual active picture size" in the second link is what is needed.

yeah i mean the conversion table.

yeah the 'actual active picture size' fits with the original displaydar variable you had.

ty again

mikeytown2
7th June 2008, 19:16
:)
well the example in this thread for one. (i guess you could edit it to reflect the change in zoombox)
resizing 1440x1080 to 720x480
with zoombox(720,480)
instead of zoombox(720,480, SourceDAR=16.0/9.0, TargetDAR=16.0/9.0)

i'd been focusing on that mostly, so it seemed like a good idea at first to have zoombox act as a regular resizer unless either, or both of the DAR values were manually set.

but i guess one could just call a regular resizer in that case.

Yeah a call to a resizer would be the best option. Also how would ZB know to set it to 16/9 if no AR info is being passed to the ZB? The whole idea of ZB is it will respect AR and not distort the clip like a call to a resizer would. This is the main reason the function is called Zoom Box, it draws a Box on top of the clip, so that if the input and output dimensions are different, it will still "look" the same.