Matching ratio of '2D images export' and animation's 'image set'

A similar post is on, Fully Custom Resolution for 2D Image Export - although I’m sure you can see in this post I’m describing a very simple single thing, Thea is elaborately rendering output and where this is merely an image dimensions export matter in it’s entirety.


First however, if you have ever lost data during webform entry - in a side note, please let me direct you to my 'Ctrl+R' gripe, where [e.g.] Notepad is the obvious answer, or an AHK script that makes it do something else - like maybe the intended 'Shift+R' instead, https://www.facebook.com/permalink.php?story_fbid=726599474043883&id=726585697378594
So to business, simply put;

Most succinctly, this post details a…,

‘resize width’,
‘crop width’,
‘resize height’,

…set of file operations in an image editor to match up 2D image exports with animation frames exports from a Sketchup model.

In detail.
I can perform certain animation feats in increments of adjustment like, ‘Move’, ‘Rotate’, etc., and exporting the 2D image for each change. Then for camerawork use ‘Add scene’, changing the view, adding another scene, etc., and export those frames [image set] instead of making a video file with Sketchup. Then I can collate the two sets of exports together in a single animation that has all I need showing e.g. panning/zooming to something with a before and after - with those 2D export interim steps achieving it.

There’s obviously a reasoning that says,
‘perform a video transition - use a fade or morph, it denotes the change about to occur will start, then the different size frames whether scaled to fit or positioned to preference will not seem out of place or jerk suddenly from one to the next’.

  • but this is more time watching and more resources being used, the simplicity in what I desire requires only that a frame is paused, where the gif size is unaffected, the internet/email inbox is less burdened.

The [Sketchup] issue is that the pixel dimensions of each of these kinds of export are different and have to be worked on to get them matching up - I’ve accomplished this already on a few occasions, but it is a little tricky - or at least quite time consuming - and best performed with the steps written down to follow for efficiently attained consistent results [hence this post], as there’s both cropping & resizing required and unfortunately in more than just two file batch operations, where the backup of the originals and new files output folders are best created in advance [I guess ideally for most named after the stage of the process they’re at for ease of understanding]…,

…so, is there a way to ensure any image [from ‘animation frames set’] export can be made the same as any other different type of [2D graphic] export?

On my computer the 2D graphic export is 1362 x 631 [same as a PrtSc once cropped to the viewed area],
The animation ‘image set’ is 1280 x 720.
[bear in mind trying to change my system screen resolution to 1280 x 720 results in a 2D export that’s 1276 x 583 - this is not exact and therefore may as well be as far out as the images from my preferred resolution].

I figured the best way was to find the same instance of an edge’s occurence in the model as these are usually just a pixel wide, and then calculated for all frames to be one size.

Two such images are provided for your perusal - best downloaded I reckon so you can see them 1:1, tiled vertically, & manipulate them in the kind of editor required for the aforementioned file operations,



Firstly it may be pertinent to glean whether the same amount of object appears in each view and then determine what needs cropping to ensure any resize operation results in images showing the same amount of object in the same position.

In my examples, the images are of two identical components one above the other [the animation will come around to this position and then the 2D export images will be added to show them being brought together], and the lower of which has a top left corner at these coordinates;

585, 238 in the [1362 x 631] 2D Graphic export,
530, 272 in the [1280 x 720] Animation Image Set export

The overall width of the objects is, 244 pixels in the 1362 wide image
The overall width of the objects is, 279 pixels in the 1280 wide image

279 - 244 = 35

35 is 14.34% of 244

244 x 1.1434 = 279

The 2D graphic exports are initially increased by this amount so that they’re 1577 pixels wide, height remains the same.

Now if I open a 1577x631 & a 1280x720 image, perform a non-aspect ratio resize on the 720 height to bring it down to 631 [width remains the same] - the two images should have perfectly matching objects [copy and paste with background colour transparency to see this overlap] - okay, perform that 720px high resized image operation on the 1577x631 files, the aim now is to make all files the same pixels size - this requires cropping,

I have around 297 pixels to lose from the 1577 wide images.
From the right first - the top right of the upper object is at,
959 in the 1577 wide image, which is [1577 - 959] 618 in from the right &
808 in the 1280 wide image, which is [1280 - 808] 472 from the right.

618 - 472 = 147

Then from the left,
The leftmost point of the objects is at,
677 in the 1577 wide image,
530 in the 1280 wide image

677 - 530 = 147

147 x 2 = 294

…so, if I perform a crop to 1280 with the image remaining centred, it should be accurate to +/-1pixel off each side…

The image files from both exports are now all the same size


You’d therefore create a folder structure for files output something like…,

\the model\animation frames export\2D Graphics export\resize1577\resize720\crop\

…or just put the crop folder content back in the animation frames folder to append those exports and hopefully all is matched up, the animation/video can be made [pending any renaming for frame numbering] and then those subdirectories can be cleaned down off the system.

Obviously I’m leaning towards a script for either Sketchup or the image editor that does this in one fell swoop - preferably the former, just as easily the latter if it’s similarly collating all the files towards that finished animation into the same location, and where BIMP performs brilliantly but one always worries that multiple edits will change the quality of the image, blacks begin to fade to grey, or the sharpness/clarity seems reduced e.g. - where anything extraneous that’s noticeable is then a distraction - so the one shot solution [plugin] is ideal and while the uniform output from both means of export would be perfect.

Any pointers?

In any event the work in this instance is done after adding a caption and cropping the animation down to a finished size, check it out,

have you tested setting your SU ‘viewport’ to this size…

then set a custom export size and aspect ratio to match that for animation and ‘use view size’ for 2d export…

with png I see a small difference in anti aliasing but size and positions are spot on…

john

Hi John, thanks for replying quickly - This would be best done using AHK’s Window Spy [‘Active Window Info’] for seeing window sizes while clicking & dragging after using an Alt+PrtSc of the ‘normal’ [any] size window to get the net dimensions to 1287 x 867 so the viewport [net] size after removing the application outer edge is 1280 x 720,
= [+7 x 147 =] 1287 x 867

…but the screen resolution is 1366 x 768

768 - 147 = 621

My 2D export is stuck on a fixed ratio too - if I type 1280 in width, the height is automatically completed as 619, and if I type 720 in the height, the width is automatically changed to 1487.

The most I can get it to without toolbars or scene tabs is 694 height.

What this would therefore entail is more than I could really be pushed to do [read: think about] for any single instance of this solution, whether in display resolution settings or unless settling for a 640x480 animation frame set - so it’s achievable but seems like much more of compromise than a preferred solution [- such a small fraction of the screen’s area]…,
<img src=“//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/sketchup/original/3X/0/5/05b9a62e5893f31d995fc2c8b9c4a012b5c5ebc8.jpg"width="1366” height=“768”>

there is a Windows SU extension to assist in changing the SU viewport size…

it’s in the Extension Warehouse by @eneroth3

I written a couple of mac ones myself…

the fixed ratio is based on the viewport size…

john

It has the scope, certainly, the maximum size export is better - I’ve dropped the author a line too, many thanks for taking the time to look at this, I’ll keep tinkering :wink:

if you set the ‘viewport’ to a ratio e.g. 9:4 then you can export any size conforming to that ratio…

I tend to use sizes divisible by 8 for best results in any image format…

john

Obviously it naturally falls to the user to get a plugin like Ms Eneroth’s viewport resizer, find a resolution proportionate to the animation frames export and use it for ease of processing,

1280 x 720 is plenty good enough for me, but I’ll show working for 1920 x 1080 too;

-10% on a 1366 x 768 display still provides an ample size window,

viewport: [-128] 1152 x [-72] 648
…the resize percentage is 1.1857638888888888888888888888889 = 118-9%*

For the 1920 x 1080 [16:9] animation frame set
-10% = [-192] 1728 x [-108] 972 creates a height that’s not a multiple of 8, so using a 16th & a 9th respectively [-120px];
viewport: 1800 x 960
has a resize of 1.06r7 [106-7%] x 1.125 = 112-3%*

*If the resize percentage input field permits only the nearest whole number, the image editor may [should] also allow exact pixel size to be input.

It may seem a bit bitty but I bit the bullet, the bet paid off, don’t need a bot…
[i.e. apologies to anyone finding the post <a href=“Chas And Dave Rabbit - YouTube”>a bit rabbit habit</a>].

(white rabbits white rabbits - Happy New Year :wink: