Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.82k stars 319 forks source link

Crop Ratio=As Image not respected in dynamic profiles #4856

Open fsenore opened 6 years ago

fsenore commented 6 years ago

I have created some dynamic profiles that add a small cropping to images taken with certain lenses to match the image that I see in the camera finder. The crop is defined for an image with landscape orientation and it works well with such images. If I open an image in portrait orientation the crop is not rotated as expected, but I get an almost square crop at the top of the image. More information at https://discuss.pixls.us/t/problem-with-cropping-in-dynamic-profiles/9269

I believe that if the image is in portrait orientation the crop should be automatically rotated.

Thanks in advance.

fsenore commented 4 years ago

Is there a chance that this bug will be fixed? Today I opened some portrait images again, and finding a square crop is really annoying.

heckflosse commented 4 years ago

Thanks for the reminder. I will have a look now.

fsenore commented 4 years ago

Here I am again. This issue is a big problem for me: I will try to explain why.

I use micro four thirds cameras where most lenses are heavily corrected in software for distortion. The jpegs created by the camera are also cropped very often, meaning that in RT I see a larger image. This is a problem because what I see in the viewfinder id not what I get in RT.

I fixed the problem by shooting images at every focal length and computing crop values for each focal length. Then I created a dynamic profile for each focal length so that images are automatically cropped when I open them. As you can imagine it took a lot of time, and I defined crops for landscape orientation.

If I open a portrait image the crop is screwed up and I have to look for the landscape crop values, convert them to portrait ones and manually input them in the crop tool. As you can image this is time consuming.

Is there hope for this issue to be fixed? I am a programmer so I suppose that fixing this issue should not be a very complicated task for anybody knowing the source code. I have no idea of how the code is organized so this would be very complicated for me, but I am desperate enough: if somebody can give me some guidance I could even try fixing it by myself.

Thanks in advance.

Lawrence37 commented 3 years ago

This looks like two issues.

The first is the crop not updating to match the image aspect ratio. When you change the width or height while editing a crop, the other value is updated to maintain the correct aspect ratio. However, when you apply a profile, the width and height are changed simultaneously while the aspect ratio is ignored. There are multiple ways of fixing this. We can keep either the width or height and adjust the other to match the aspect ratio. We can also calculate a new crop with the same area as the previous crop.

The other issue and the one you need to be solved is dealing with portrait vs. landscape orientations. Let's say you have a 4008x3006 (4:3) image an you want to crop it to the center 4000x3000. You will need to set the left to 4, top to 3, width to 4000, and height to 3000. If you want to apply this crop to a portrait image, you need to swap the width and height AND the left and top values. The best solution I can come up with is to allow a separate method for specifying the crop based on the image's long and short side. In this example, you can make a crop by setting the "from shortest left/top side" to 4, "from longest left/top side" to 3, "long side direction length" to 4000, and "short side direction length" to 3000.

fsenore commented 3 years ago

I agree that using long and short side instead of width and height looks like a smart move.

mwiest commented 3 years ago

Yes, that would be great, I have the same issue, and in other threads discussing this, it was suggested to use the raw_crop in camconst.json, which kind-of works, but removes the option to later change the crop in RT. Ideally I would want to make this a dynamic profile to apply to all files, which would give me the option to move the crop in certain files, while having the default (center) applied automatically by default.