Project

General

Profile

Bug #9396

Watermark alignement calculation is broken for images higher than wide

Added by David Morel about 7 years ago. Updated about 7 years ago.

Status:
Fixed
Priority:
Low
Assignee:
Category:
General
Start date:
04/28/2013
Due date:
% Done:

100%

Estimated time:
Affected Version:
1.2
System:
all
bitness:
64-bit
hardware architecture:
amd64/x86

Description

When using a watermark that is higher than wide, the computation of width is wrong and result in an odd result: the watermark alignement set as centered seems to align to the left side of the watermark.

Attached are 2 files showing the hasselblade.svg watermark in use: what should be the result, and what the result is.

After some investigation, it seems that this is due to the computation of the width based on the ratio being wrong.

expected.jpg (255 KB) expected.jpg David Morel, 04/28/2013 01:49 AM
result.jpg (256 KB) result.jpg David Morel, 04/28/2013 01:49 AM

Associated revisions

Revision 7f30c737 (diff)
Added by David Morel about 7 years ago

Fix #9396: Correct watermark alignement computation

When using a higher than wide images, the ratio computation were
inverted.

Signed-off-by: bleader <>

History

#1 Updated by David Morel about 7 years ago

Suggested fix:
https://github.com/bleader/darktable/commit/808dfa2eae420c1cbb607aeb415a3af313abca9d

If that seems fine, I can send a pull request.

#2 Updated by David Morel about 7 years ago

  • % Done changed from 0 to 70
  • Status changed from New to Patch attached

Forgot to set patch attached as status.

#3 Updated by Pascal Obry about 7 years ago

Looking at the jpeg it looks to me as if you have not properly selected the alignment. If you click in the upper-left corner in the alignment widget the hasselblade svg is properly rendered. Can you confirm this?

#4 Updated by David Morel about 7 years ago

I can confirm that selecting upper-left corner in alignment is will display a correct render, but this is because the scale is the same as the image, and that this is 100% scale, it still is not the intended behavior

Centered should not put the watermark over the right part of the image, it should be centered.

Take the time to look at the patch suggested, you can see that the computation of svg_width contains a mistake. I printed the values to find out were the issue was, and width had nothing to do with the actual ratio of the image, which make sense based on the inverted divison.

#5 Updated by Pascal Obry about 7 years ago

  • Assignee changed from David Morel to Pascal Obry

Looking more at the code it is clear that your patch is obviously correct :) Please send a pull request, I'll merge. Thanks.

#6 Updated by David Morel about 7 years ago

Thank you, will do now.

#7 Updated by Pascal Obry about 7 years ago

  • % Done changed from 70 to 100
  • Status changed from Patch attached to Fixed

Merged, closing this ticket. Thanks.

Also available in: Atom PDF

Go to top