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
Created attachment 42510 [details] Patch for batchtoolsmanager.cpp to add new tool
Mikkel, This tool already exist in digiKam 1.1 and 1.2. Why not to improve it instead to create new one ? Gilles Caulier
Created attachment 42513 [details] New tool cpp file To be placed in: digikam/graphics/digikam/utilities/queuemanager/basetools/decorate/imagewatermark.cpp
Created attachment 42514 [details] Header file
Screenshot of current Watermark tool for Batch Queue Manager : http://farm5.static.flickr.com/4014/4494397892_f122f1c118_b.jpg Gilles Caulier
Current code of watermake tool : http://websvn.kde.org/*checkout*/trunk/extragear/graphics/digikam/utilities/queuemanager/basetools/decorate/watermark.cpp?revision=1102593 Gilles Caulier
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
The tool that you are talking about is actually the tool that I have improved upon. Mikkel
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
Mikkel, Your code and my code need to be merged. Just patch the current tool as well, it's enough. Gilles Caulier
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
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
Mikkel, Any progress. Do you need help ? Gilles Caulier
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
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
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.
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
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
My appologies. I just forget to check again your patch. I will do it soon. Gilles
No problem. I know there are many tasks for you to do.
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
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
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
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
Is it possible to know in which release it will be available this great patch? tnx
digiKam 1.3.0 Gilles Caulier
(In reply to comment #26) > digiKam 1.3.0 > > Gilles Caulier Tnx, I hope it will be backported soon to 10.04 Leo