Bug #9295

auto-scale is not working in lens correction

Added by Christian iuga about 7 years ago. Updated over 6 years ago.

Closed: upstream
Target version:
Start date:
Due date:
% Done:


Estimated time:
Affected Version:
git development version
other GNU/Linux
hardware architecture:


Hi, for me , the auto-scale is not working in the lens correction (test on the git version & stable 1.1.3)

I have reade the manual about it :
" Pressing the auto scale button (right to the slider) will let darktable find the best fit to avoid black corners."
& see information about it on

But for me, even with the auto-scale button, it's not working (but it's will be good to auto-scale also : #9105)

20130113_0017.CR2 (23.7 MB) 20130113_0017.CR2 A file where the bug is present Christian iuga, 03/15/2013 12:24 AM
20130113_0017.CR2.xmp (6.77 KB) 20130113_0017.CR2.xmp xmp associed file Christian iuga, 03/15/2013 12:24 AM


#1 Updated by Torsten Bronger about 7 years ago

My LensFun version doesn't contain profiles for this lens, so I can only guess: LensFun doesn't autoscale properly in all cases. I know that for sure but I haven't yet had time to file a bug report at LensFun. I kindly ask Christian iuga to do so at

#2 Updated by Tobias Ellinghaus about 7 years ago

  • % Done changed from 0 to 10
  • Status changed from New to Confirmed

I can confirm this. Pictures taken with my 40D don't get scaled while those from a 5D3 with the same lens do work. However, I have to manually select a 5D2 since the 5D3 isn't in my lensfun db yet.

#3 Updated by Torsten Bronger about 7 years ago

Because the 40D and the 5D3 have different sensor sizes, LensFun applies different correction formulae. This leads to different situations when it comes to auto-sizing, and as I said, I strogly suspect LensFun does something wrong here.

However, I haven't yet investigated this in LensFun.

#4 Updated by Christian iuga about 7 years ago

I dont' understand why your lensfun doesn't contain profiles for this lens

When i browser the svn of lensfun, it's in :
<model>Canon EF-S 55-250 f/4-5.6 IS</model>
<mount>Canon EF</mount>
<calibration> <!-- data gathered by Spoilerhead 2010 <> using hugin-->
<distortion model="ptlens" focal="55" a="-0.000303056" b="-0.00581537" c="-0.00237143" /> <!-- 15 shots-->
<distortion model="ptlens" focal="70" a="-0.000520255" b="2.86405e-05" c="0.00286934" /> <!-- 21 shots -->
<distortion model="ptlens" focal="100" a="0.00268582" b="-0.00578304" c="0.00718748" /> <!-- 17-->
<distortion model="ptlens" focal="135" a="0.00120309" b="0.00979416" c="-0.00868762" /> <!-- 15 -->
<distortion model="ptlens" focal="250" a="-0.00226069" b="0.0111545" c="-0.00536676" /> <!-- 18 -->
So, for this lens, it's available the distortion, but not (yet) transversal chromatic aberration (tca) & vignetting.
I also have checked, just now, this data is also present on the 0.27 & 0.26 stable version of lensfun
My camera is a canon 550D, also on the database, so normaly it's should work, isn't it ?

#5 Updated by Torsten Bronger about 7 years ago

Yes, maybe I have an incomplete database. But this doesn't affect my analysis of this issue, because I know this erroneous behaviour from my own pictures, too.

#6 Updated by Torsten Bronger about 7 years ago

I must correct myself. In my case, the issue was that LensFun returned more than one lens in lens.c (line 1616):

const lfLens **lenslist = lf_db_find_lenses_hd (dt_iop_lensfun_db, g->camera, NULL, p->lens, 0);
if(lenslist && !lenslist[1]) {

I have a ~/.local/share/lensfun directory, and this contained a copy of my lenses. Once I had assured that the lens could not be found twice by LensFun, the autoscaling worked.

#7 Updated by Torsten Bronger about 7 years ago

I can now select the lens, and distortion calibration is applied. However, the autoscale button works as expected, too (leading to a scaling of 1.013).

Christian, you see distortion applied (i.e. black corners), but clicking on the circular arrow has no effect?

#8 Updated by Christian iuga about 7 years ago

Yes it was the case
Now it's working as expected (you have change something or someone else like see on mail devel-list about heuristic search ? )

It's also make sense what do you said as my lens was reported as "Canon EF-S 55-250mm f/4-5.6 IS" via exiftoo & in slr-canon.xml it's "Canon EF-S 55-250 f/4-5.6 IS" whithout the "mm" ...

#9 Updated by Torsten Bronger about 7 years ago

Can anybody upload RAW files which reproduce this bug?

#10 Updated by Torsten Bronger almost 7 years ago

I can see dark corners after auto-scaling if you try to convert from fisheye to equirectangular. But this clearly is a LensFun bug. I filed it at

As far as the missing autoscaling in case of duplicates in LensFun's database is concerned -- I don't know yet whether this is LensFun or DT. I know that LensFun doesn't deal well with duplicates. On the other hand, the lens correction itself is applied, why isn't the autoscaling?

#11 Updated by Tobias Ellinghaus over 6 years ago

  • % Done changed from 10 to 20
  • Status changed from Confirmed to Incomplete

Any new insights about the issue? Is that an upstream bug or us?

#12 Updated by Torsten Bronger over 6 years ago

As far as I can see, the only remaining issue regarding autoscale is a LensFun bug.

#13 Updated by Tobias Ellinghaus over 6 years ago

  • % Done changed from 20 to 0
  • Status changed from Incomplete to Closed: upstream

Great, so I can close here.

Also available in: Atom PDF

Go to top