Vegas crops vertical size on certain images

Gary James wrote on 2/27/2014, 1:13 PM
I’ve verified the problem is present in SVP v9.x and v11.x; and may well still be present in v12.x. This is an odd bug that I first ran across about 3 years ago, but never paid much attention to because it only effects some images. I first noticed the problem when I was running the “Matchaspect.js” script that comes with the everything.zip script pack. Most all of the images adjusted by the script fit the preview window perfectly. But every so often an image would appear with a tiny black border above and below the image. I’d have to bring up the Pan / Crop Window then right-click and Restore the Image to make it fill the preview window.

I finally decided to look into the problem and found what appears to be a bug in the way Sony Vegas scales certain sized images that are close to the A/R of a Widescreen project. My tests used a 1966 x 1100 pixel Image. The image is a solid Yellow box with the outermost one pixel border colored Red. When the image is placed in the Vegas Timeline, the top and bottom Red edges are missing. And when I run the “Matchaspect.js” script, the vertical size of the image shrinks, producing the black upper and lower borders, but the Red pixel edges are still missing. In other words, Vegas internally cropped the upper and lower edges of the image, and there’s nothing that can be done to bring them back.

What’s even stranger is if you use the Vegas Pan / Crop Window’s Context Menu to “Reset”, then “Match Output Aspect”, you don’t get the black upper and lower border. But you still don’t see the Red upper and lower edges. My guess is that Vegas is using the internally cropped image dimensions to make its Output Aspect calculations and adjustment. Is this still a problem in v12.x?

Here’s the download link to the 1966 x 1100 image,

Comments

John_Cline wrote on 2/27/2014, 3:12 PM
This behavior seems perfectly normal, 1920x1080 has a aspect ratio or 1.777777, your 1966x1100 image has an aspect ratio of 1.7872727. The black upper and lower border is inevitable unless you turn off "maintain aspect ratio" in the image's properties. Also, the fact that a 1-pixel wide border disappears from your image is not surprising since when the image is rescaled down slightly, the 1-pixel red border is now smaller than 1 pixel.
NormanPCN wrote on 2/27/2014, 4:45 PM
I downloaded the file and it seems fine in a 1920x1080 project with match aspect ratio selected. I saw no black bars. I lost the red border on the sides, but this is reasonable since image cannot scale perfectly for that 1 pixel border.

I did not try the script. How can you reproduce the issue without using the script?
Gary James wrote on 2/27/2014, 8:17 PM
" How can you reproduce the issue without using the script?"

You've touched on the other side of the problem in that Vegas must be using internal proprietary information regarding how the image dimensions are rounded, that it doesn't make available to the Programming API. In a Widescreen DVD project, the Match Output Aspect script creates an almost 20 pixel shrinkage in the vertical size of the image. But when the Pan / Crop window's Match Output Aspect context menu is selected, the vertical size is untouched, and instead the horizontal size is reduced by 1/2 pixel.

Here's the Pan / Crop dimensions after running the script.


Here's the Pan / Crop dimensions after selecting the built-in Match Output Aspect function. Close enough to make the image look like it fills the screen.


That's a pretty large difference in how the image dimensions are rounded for what should be the same results. The purpose of the script and the built in equivalent function is to re-scale the image so it fills the screen, but Vegas isn't providing accurate enough information via the API for the script to function properly. And that's why the black letterbox bars appear when the script is used.

John_Cline wrote on 2/27/2014, 11:21 PM
Widescreen HD and widescreen SD have slightly different aspect ratios. Regardless, your 1966x1100 image is slightly wide than exactly 16x9, in order to fit in a true 16x9 frame and still maintain the 1:1 pixel aspect ratio, something is going to have to give.