Crop to number of pixels?

Hi. I am doing most of my work for print, and so I have a minimum size in pixels for my images. There are many cases where I want to crop as tightly as possible, without exceeding some limitation. For example, I might want a crop which is no smaller than 3508 x 2480 pixels if I am printing to A4 at 300DPI.

Is there a way I can give a numerical value in pixels to the crop module? My current solution is to enter the margin values as percentages by hand, and then save it as a preset. This is annoying to do, and the results will be wrong when the image is from a different camera or some other source.

Hi Bob

When opening the aspect dropdown in crop you can enter the format as e.g. 3508:2480 and hit enter. There is no prompt or field, just type.

Patrik

1 Like

Interesting. When I enter 3508:2480 or 2480:3508, it will give me “877:620 1.41”, and the crop extends to the full height of the image. I’m guessing it doesn’t read this as pixels, but as a ratio. Likewise, if I type 800:600, it will round this to 4:3. Is there something missing from your solution?

Using darktable 4.8.1 on MacOS

Exactly. From the manual :

You can also enter any other ratio after opening the combobox by typing it in the form of “x:y” or as a decimal (e.g. “0.5” to apply a ratio of 2:1).

So the answer is that you can’t. You need to manually drag the edge until you see the number of pixels that you want. And then you need to put it exactly in the center somehow before saving it as a preset, if you have OCD.

Just adding to this in case there are others that, similar to me, have been wondering how to see the pixel count of a cropped picture without preforming an export or opening the crop module and start dragging a margin to have the pixel information displayed in the midst of the main window:

It took me quite some time to discover that after the crop module is closed, two lines will be updated in the image information module below the “width” and “height” lines: “export width” and “export height” …

1 Like

you can’t crop to a specific pixel count in crop module.
darktable isn’t focused on editing to numbers - so cropping is expected to be focused on content. Whatever output size you need is done in the export module by scaling.

Fixed pixel numbers for cropping was discussed frequently but not considered when redesigning crop module.

1 Like

I have made a few presets with different aspect ratios, because I wanted to be sure not to go below a certain final size in pixels. Those are a bit finicky to set up (not easy to hit the exact pixel size), but that’s only once…

Use: pick a preset, and move it around and enlarge as wanted.

As there is a way to define margins in %, perhaps that could be extended to pixel precision?

1 Like

In case this were a feature request, I would also be happy with a “limit” setting which stops the crop handles from becoming smaller than some size in pixels.