Crop not always exactly the right aspect ratio

There will be no errors when rounding the numbers if the software or the user make the calculations that I suggested above.
The only rounding needed would be done during export, when choosing a dimension for the long side of the photo that, when devided by the largest number in the aspect ratio, will result in a non-rounded number. But that is only during export, the moment where the user picks the size of the photo.

My calculations are as follows

When cropping I look at the size of the crop (below the photo in the editing window) and make sure that the large number is devisable by 3 and the short side is devisable by 2. This would ensute that the resulting photo has the exact 3 x 2 aspect ratio.
It’s a pain to do so (having to make the calculations myself and being very precise with the mouse or trackpad), but it works. When I export the photos from my Z8 to 7500 pixels on the long end the short end is exactly 5000 pixels and the aspect ratio is exactly 3 x 2.

It would most certainly help if the software would do the above mentioned calculations for me and snap the crop to the nearest position while cropping to retain the chosen aspect ratio.

When deviding the pixel count of the long end of a photo by 3 (for example) the result could be a fraction.
That fraction needs to be rounded first and the rounded number should be used to calculate the pixel size on the long side (times 3) and the short side (times 2) to get a perfect aspect ratio of 3 x 2.
These calculations should be performed while using the crop tool and the crop frame should snap to the nearest possible position.
And for those who don’t like this snapping into place, the user should be able to disable this feature.

May I ask why you need that precision?

George

1 Like

You know, sometimes it helps to look at the software to see what is already possible


Take an image, any image. Crop it to 3 x 2. Export, using the Resize checkbox and choosing the Fit resizing mode and specifying the exact dimensions for the two axes.

You will now get an exported image that is precisely what you want, unless the proportions are too far out of range to be adjusted automatically.

And, don’t worry. I only just discovered this 20 minutes ago :crazy_face:

1 Like

Screenshot of cropped image with dimensions that differ slightly on the toolbar and palette


Screenshot of exported image information


I am not familiar with Swift, but for me it looks like your code tests 4/2 = = 4, and not = = 2, which is indeed False.

Ooops! One of those times when the compiler precision checking has improved since I last demonstrated that.

Try this


So, instead of using whole numbers, given that mouse coordinates are pairs of floating point values, if you drew a crop that ended up measuring a floating point value and needed it to be scaled by another floating point value, this is where you are more likely to see this kind of error.


But, as I said, PL actually provides a way of exporting to precise pixel size, so all this calculating techie stuff is fairly irrelevant.

1 Like

This setting simply uses the dimension and fits the image into the given “window”.
Exporting a 3x2 image to 1800y1200 pixels in both landscape and portrait orientation will result in one export being 1800x1200 and the other is reduced to 800x1200.

:face_with_hand_over_mouth:

Fitting both crop and export (in integer) will mostly produce non-integer results.

But the OP is about snapping to “allowed” pixel dimensions in crop only. If we wanted to get exact output, we could do something like this:

  • Define output pixel dimensions → PL will draw the respective frame lines
  • Resize the image “under the frame” until the desired content is in the frame.
  • Press “Apply” (which should trigger export to ignore dimensions in its dialog)

Aaaahhh but
 After cropping to 3 x 2 or 2 x 3 proportions, if you set the export dimensions to 7500px square, You get the appropriate 5000 x 7500 for portrait and 7500 x 5000 for landscape. At least in the tests that I have just done.

Not very obvious but
 :crazy_face:

It works well
if the crop aspect ratio is the same as the one for export
unless one mistakes the long side for the short side of course. :crazy_face:

Anyways, there are plenty of workarounds, and limiting ratios to integer values according to what is selected would help the OP and possibly serve a few use cases too.

There is an other thread about square not being square on when I tested the above, I found that getting exact squares can get tedious. Enabling the arrow keys to size and position a crop frame could be another approach.

Have you tried the “Fit” setting to both the same size for that?

yes, I tried “Fit” for export, but I was referring to crop.

My thought was whether the export setting was able to overcome the crop inequality

I was testing this with a square crop and a 3x2 export. Crop wins, the fit values have no consequence regarding the aspect ratio of the exported image.

Was gone on a short trip for the past two days, so just now with the computer at hand I can clarify my findings. An example


I’ve cropped a photo that I took during a concert.
Original size: 8256 x 5504
Cropped size: 5916 x 3944
In both cases the aspect ratio is exact 3 x 2 (see the image).

When exporting I choose “Longest side” for Resizing Option and choose 7500 pixels for the longest size, expecting the output would be 7500 x 5000 pixels (also a 3 x 2 aspect ratio).

The resulting photo after export however was 7500 x 4992 pixels.

I could use one of the other export options (“Fit” or “Proportional”), bit when executed correctly a 3 x 2 cropped photo should be exported as a 7500 x 5000 pixels photo when the option “Longest Side” is chosen.

There could be on of two possible issues here:
a. The crop tool contains a bug and the shown cropped size in pixels is not accurate;
or
b. The export feature has a bug and is unable to calculate the proper short side of the photo based on the chosen aspect ratio of the photo during editing

For other 3 x 2 cropped photos I’ll have to investigate the actual cropped size and the exported JPG further.

My point is, that when exporting an image that has been cropped in true 3 x 2 aspect ratio (according to the information in the crop tool) should be exported as an image in 7500 x 5000 pixels, whether I choose 7500 and “Longest Side” as the Resizing mode or 5000 and “Shortest Side”.

I’ll have to see whether the other options yield the expected results.

I’ve never seen an export to a file that is wider than the number of pixels after cropping. here, there is a transition from crop=5916 to export=7500.

I’ll have to check that



and it looks like PhotoLab is also enlarging images when necessary

Ah well, live and learn.

Another example, with another photo taken during the same concert.


As you can see in the above screenshot, the photo was cropped more but the crop still has a perfect 3 x 2 aspect ratio (the crop is 5538 x 3695).


The resulting export, again using “7500” and “Longest Side” for the Export Ratio, however was 7500 x 5004 pixels. Again no perfect aspect ratio of 3 x 2.

Not exactly. It should be 5538x3692, 3 rows different.

George

1 Like