Add new comment

We don't know of a general

We don't know of a general answer to this question that will always work.
For example:

  • Some previews (on some cameras) contain a black border on the right/left, which is not part of the RAW image, so no pixel in RAW corresponds to the left-top (or any) preview image corner.
  • The lens geometry correction has been applied to the preview, so its edges do not correspond to any straight horizontal/vertical line in the RAW
  • Aspect ratio in the preview may be not exactly the same as RAW image area.

In some cases imgdata.sizes.raw_inset_crops[..] may work.

-- Alex Tutubalin @LibRaw LLC