Skip to main content
dublove
Legend
Jul 31, 2025 4:01 AM UTC
Answered

What is the basis for using FILL_PROPORTIONALLY and PROPORTIONALLY?

Is it sometimes necessary to distinguish between their uses?
What is the basis for their use?

In the code below, if I use both

sel[j].fit(FitOptions.FILL_PROPORTIONALLY);
sel[j].fit(FitOptions.FRAME_TO_CONTENT);

the first one will display incorrectly.  I looked at it for a long time and didn't find much difference in their data sources.

 

        if (sel.length == 1) {
            sel[j].visibleBounds = [sb[0], lcb, sb[2], rcb];
            
            if (cp.length == 2) {
                sel[j].fit(FitOptions.PROPORTIONALLY);
                sel[j].fit(FitOptions.FRAME_TO_CONTENT);

            }
            if (cp.length > 2) {
                sel[j].fit(FitOptions.FILL_PROPORTIONALLY);
                sel[j].fit(FitOptions.FRAME_TO_CONTENT);
            }
        }

 

dublove
dubloveCorrect answer
Legend
Jul 31, 2025 10:55 AM UTC

Yes, as you said.
This is the basic attribute usage.

Later, I found the problem.
If the image is too large and exceeds the boundaries, you can only use
sel[j].fit(FitOptions.PROPORTIONALLY);
sel[j].fit(FitOptions.FRAME_TO_CONTENT);

 

If you must use the following, you must first find a way to reduce the size of the image.
sel[j].fit(FitOptions.FILL_PROPORTIONALLY);
sel[j].fit(FitOptions.FRAME_TO_CONTENT);

2 replies

brian_p_dts
Community Expert
Community Expert
Jul 31, 2025 10:39 AM UTC

PROPORTIONALLY is the equivalent of the UI Fitting option, Fit Content Proportionally. FILL_PROPORTIONALLY  is the equivalent of Fill Frame Proportionally. In the first case, the image fits inside the frame fully, so you would have white space either horizontally or vertically, likely. With filk proportionally, the image will be cropped horizontally or vertically. 

Translate
dublove
dubloveAuthorCorrect answer
Legend
Jul 31, 2025 10:55 AM UTC

Yes, as you said.
This is the basic attribute usage.

Later, I found the problem.
If the image is too large and exceeds the boundaries, you can only use
sel[j].fit(FitOptions.PROPORTIONALLY);
sel[j].fit(FitOptions.FRAME_TO_CONTENT);

 

If you must use the following, you must first find a way to reduce the size of the image.
sel[j].fit(FitOptions.FILL_PROPORTIONALLY);
sel[j].fit(FitOptions.FRAME_TO_CONTENT);

Translate