Bug 233409 - Image watermark in batch queue manager
Summary: Image watermark in batch queue manager
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Bqm-WaterMark (show other bugs)
Version: 1.3.0
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-05 20:10 UTC by Mikkel Christensen
Modified: 2016-07-03 20:01 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.3.0
Sentry Crash Report:


Attachments
Patch for batchtoolsmanager.cpp to add new tool (597 bytes, patch)
2010-04-05 20:12 UTC, Mikkel Christensen
Details
New tool cpp file (8.77 KB, patch)
2010-04-05 20:17 UTC, Mikkel Christensen
Details
Header file (1.44 KB, text/x-chdr)
2010-04-05 20:18 UTC, Mikkel Christensen
Details
Improved watermark tool that allows image overlays. (24.63 KB, patch)
2010-04-12 16:22 UTC, Mikkel Christensen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikkel Christensen 2010-04-05 20:10:34 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

I would like an image watermark tool in the batch queue manager just like the current text watermark tool.

I have implemented this, and I will attach patch and new files.
There is one point that I don't know how to handle best because I am new to KDE, Qt, and Digikam development, and that is how to best make a "Select image file" dialog and button.

So in my new tool, there is just a KLineEdit for typing in the full path of the watermark image file. I hope you can give me advice on this point.

I hope this will be the beginning of a more active involvement in Digikam development on my part.

Best regards,
Mikkel Bækhøj Christensen
Comment 1 Mikkel Christensen 2010-04-05 20:12:12 UTC
Created attachment 42510 [details]
Patch for batchtoolsmanager.cpp to add new tool
Comment 2 caulier.gilles 2010-04-05 20:13:59 UTC
Mikkel,

This tool already exist in digiKam 1.1 and 1.2. Why not to improve it instead to create new one ?

Gilles Caulier
Comment 3 Mikkel Christensen 2010-04-05 20:17:03 UTC
Created attachment 42513 [details]
New tool cpp file

To be placed in:
digikam/graphics/digikam/utilities/queuemanager/basetools/decorate/imagewatermark.cpp
Comment 4 Mikkel Christensen 2010-04-05 20:18:57 UTC
Created attachment 42514 [details]
Header file
Comment 5 caulier.gilles 2010-04-05 20:19:29 UTC
Screenshot of current Watermark tool for Batch Queue Manager :

http://farm5.static.flickr.com/4014/4494397892_f122f1c118_b.jpg

Gilles Caulier
Comment 7 Mikkel Christensen 2010-04-05 20:23:27 UTC
Wow, you are quick!

I have not found a tool in Digikam to add an image watermark. I have found the
text watermark tool only. Is there another one? Based on the text watermark
tool, I have made this tool that adds an image instead of text.

I thought it would be just as flexible to have to different tools in the Batch
queue, but if you want me to integrate the two, I will probably be able to do
that. However, I would be pleased if you can take the time to look at what I
have already done.

Best regards,
Mikkel
Comment 8 Mikkel Christensen 2010-04-05 20:26:39 UTC
The tool that you are talking about is actually the tool that I have improved upon.

Mikkel
Comment 9 caulier.gilles 2010-04-05 20:28:35 UTC
No, there is no tool to watermark a photo with a logo or a small image. Ther is only the curent tool to watermark a photo with a text.

I'm agree to add this new feature : watermark with a logo. But this feature must be merged with the current Watermark tool. It's not very difficult to do.

In fact, add a combobox to settings widget to give to user the way to select to add a text or a logo as wartermark.

What do you think about ?

Gilles Caulier
Comment 10 caulier.gilles 2010-04-05 20:32:02 UTC
Mikkel,

Your code and my code need to be merged. Just patch the current tool as well, it's enough.

Gilles Caulier
Comment 11 Mikkel Christensen 2010-04-05 20:36:33 UTC
I will look at merging them. It might take some time, because the Qt gui programming is the hardest part for me, because this is the first time I have touched Qt.

Do you have any advice about how to do an "Open file" dialog instead of the KLineEdit?

Mikkel
Comment 12 caulier.gilles 2010-04-05 20:46:55 UTC
Use this widget :

http://api.kde.org/4.4-api/kdelibs-apidocs/kio/html/classKUrlRequester.html

Check digiKam code, there is a lots of sample to get inspiration...

Gilles Caulier
Comment 13 caulier.gilles 2010-04-06 19:08:34 UTC
Mikkel,

Any progress. Do you need help ?

Gilles Caulier
Comment 14 Mikkel Christensen 2010-04-06 20:16:03 UTC
I think I have what I need. KUrlRequester was exactly the right thing - very easy to use.
Unfortunately, now that the easter vacation is over, I need to prioritize my day job programming, so I probably won't finish the watermark code until the end of this week. But I will do it, don't worry.

Mikkel
Comment 15 Mikkel Christensen 2010-04-12 16:22:40 UTC
Created attachment 42716 [details]
Improved watermark tool that allows image overlays.

I think this patch should do the trick. I changed the text part a bit too to make it more flexible. I hope you like it.

Mikkel
Comment 16 Fri13 2010-04-12 17:15:48 UTC
Is there going to be a option to set position from corner with pixels?

Like first you select the corner or center position (middle on vertical and horizontal position). Then the range in pixels from them to nearest edge/corner of watermark image.

Of course with % amount with both axis we could have a watermark where we want. But it should be centered someway to middle so the watermark can be centered easily without needed to find out how to get it centered properly.
Comment 17 Mikkel Christensen 2010-04-12 20:26:12 UTC
I do not plan to add an offset in pixels. In the batch queue, you could be adding watermarks to images with different sizes, and in that case, a pixel offset will give varying results.

But if I understand you correctly, you want to center the watermark in the image? If that is the case, you will be glad to know that I have already added a "center" option in addition to "top left", "top right", "bottom left", "bottom right".

Mikkel
Comment 18 Mikkel Christensen 2010-06-01 14:51:40 UTC
Hi Gilles,

It is now some time since I finished this improved watermarking feature. Is there anything else I need to do to get it considered for committing to trunk?

Regards,
Mikkel
Comment 19 caulier.gilles 2010-06-01 15:03:18 UTC
My appologies. I just forget to check again your patch. I will do it soon.

Gilles
Comment 20 Mikkel Christensen 2010-06-01 15:04:20 UTC
No problem. I know there are many tasks for you to do.
Comment 21 caulier.gilles 2010-06-03 10:36:51 UTC
SVN commit 1134037 by cgilles:

apply patch #42716 from Mikkel Baekhoej Christensen to apply image watermark in BQM
BUGS: 233409


 M  +317 -66   watermark.cpp  
 M  +1 -0      watermark.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1134037
Comment 22 caulier.gilles 2010-06-03 10:53:45 UTC
Mikkel,

I reviewed you patch and apply some minor polishing in code. I will apply it to svn and close this file.

Next stage for you, if you is agree, is a little bit complicated but necessary for the future. i already do it for other tools shared between editor and queue manager. The goal is to share a classes using common implementation set in digikam/dimg/filters. Look the status there :

http://websvn.kde.org/trunk/extragear/graphics/digikam/imageplugins/TODO?revision=1134027&view=markup

Typically, all tools from editors must be available in BQM. It's not yet case. Image WaterMark from BQM is in fact InsertText tool from editor. Not all code can be shared of course, because we don't have/cannot see preview of text placement over image in BQM, but at least, the code to patch image with inserted text can be the same.

To do that there is some factoring to do :

1/ a settings widget must be created. This one will embed common settings available into BQM and Editor tools. This widget code must be placed there :

http://websvn.kde.org/trunk/extragear/graphics/digikam/libs/dimg/filters/decorate/

Files must be named watermarksettings.cpp/.h

The common code to merge is defined there :
- inserttexttool.cpp#136::242
- watermarktool.cpp#131::261

2/ a new class must be created to host code used to patch the image with insert text/image. We must use DImgThreadedFilter class as parent, to be able to use the code in a separate thread.

http://websvn.kde.org/trunk/extragear/graphics/digikam/libs/dimg/filters/dimgthreadedfilter.h?revision=1115803&view=markup

This class must be placed at the same place than watermarksettings class. Files must be named watermarkfilter.cpp/.h

of course, some code must be taken and merged from :

- WaterMarkTool::toolOperation()
- InsertTextWidget::makeInsertText()

Globally, the best way to do it, is to 

- Extend your current code from WaterMark tool to include missing option to set text, and already implemented in inserttext tool
- To rewrite Inserttext tool and factoring code using shared implementation done with WaterMark tool.

Look also in already tools shared between editor and BQM, as BorderTool :

http://lxr.kde.org/source/extragear/graphics/digikam/libs/dimg/filters/decorate/borderfilter.h
http://lxr.kde.org/source/extragear/graphics/digikam/libs/dimg/filters/decorate/bordersettings.h
http://lxr.kde.org/source/extragear/graphics/digikam/utilities/queuemanager/basetools/decorate/border.h
http://lxr.kde.org/source/extragear/graphics/digikam/imageplugins/decorate/bordertool.h

Let's me hear if you is interested to do this job. 

Thanks in advance

Gilles Caulier
Comment 23 Mikkel Christensen 2010-06-03 11:02:40 UTC
Yes, I am interested in doing that. I actually thought about asking you about
how to make BQM tools available in the normal editor. Thank you for the
thorough explanation.

I will not have time to work on this for probably 3 weeks, because I have some
work and travelling to do, but I will probably get on it in late June, early
July.

Regards,
Mikkel
Comment 24 caulier.gilles 2010-06-03 11:07:19 UTC
Great. thanks in advance for your future contributions.

i recommend to open a new file in bugzilla about this subject and to post future patches at this place.

Gilles Caulier
Comment 25 Leo 2010-07-08 13:34:46 UTC
Is it possible to know in which release it will be available this great patch?
tnx
Comment 26 caulier.gilles 2010-07-08 13:37:38 UTC
digiKam 1.3.0

Gilles Caulier
Comment 27 Leo 2010-07-09 09:06:02 UTC
(In reply to comment #26)
> digiKam 1.3.0
> 
> Gilles Caulier

Tnx, I hope it will be backported soon to 10.04

Leo