Skip to main content
dublove
Legend
July 31, 2025
Answered

What is the basis for using FILL_PROPORTIONALLY and PROPORTIONALLY?

  • July 31, 2025
  • 1 reply
  • 224 views

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);
            }
        }

 

Correct answer dublove

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);

1 reply

brian_p_dts
Community Expert
Community Expert
July 31, 2025

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. 

dublove
dubloveAuthorCorrect answer
Legend
July 31, 2025

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);