Bug 273751 - BQM Watermark tool : Add support for svg and variable parts
Summary: BQM Watermark tool : Add support for svg and variable parts
Status: REPORTED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Bqm-WaterMark (show other bugs)
Version: 2.0.0
Platform: Unlisted Binaries Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2011-05-20 20:37 UTC by Markus Rennings
Modified: 2019-02-24 10:14 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch to implement SVG watermark features (24.38 KB, patch)
2017-03-12 17:37 UTC, Ahmed Fathi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Rennings 2011-05-20 20:37:53 UTC
Version:           unspecified
OS:                Linux

I saw in DarkTable (http://darktable.sourceforge.net/ ) that they support svg files as watermarks. They provide also some placeholders/variables--such as $(EXIF.DATE), $(IMAGE.EXIF), $(EXIF.LENS) and so on--to place inside that svg.

I think that svg is a good format for a watermark as you can lossless change its size (width × height). With the placeholders you can embed e. g. the filename (say, you rename your images like yyyymmddxxxxxx, where ymd is year/month/day and x some "serial number" or simply a counter). With that you can embed something like "ID: $(FILENAME) \n © my name". Or to use the example from darktable: 
   $(IMAGE.EXIF)
      Camera: $(EXIF.Maker) - $(EXIF.MODEL) $(EXIF.LENS)
   Timestamp: $(EXIF.DATE)             $(DARKTABLE.NAME) v$(DARKTABLE.VERSION)

I'm sure, that there are much more ways to use this feature, so it would be nice if you could implement it.

Reproducible: Always
Comment 1 Ahmed Fathi 2017-03-05 19:35:36 UTC
SVG watermarks can be read into digikam as QImage can deal with them by default. I have made some modifications to the code to allow inserting text into the svg images, by inserting actual XML strings into the original SVG xml data just before applying it as a watermark.This structure is now ready. What remains is to know what you prefer the feature to look like. I can supply a text box where the user enters whatever text he wants, and provides the x,y position into the svg image and the required font size , and his/her text gets inserted in the svg. I can add  check boxes to automatically insert the image filename and/or current date into the text of the watermark in the svg. Are these good? Are they enough? 
Thanks
Comment 2 caulier.gilles 2017-03-05 20:05:39 UTC
Ahmed,

I think the first step that you propose is enough for the moment.

Also, you can take a look to darktable to see how this feature work exactly. This can be a good start :

https://www.darktable.org/usermanual/ch03s04s05.html.php

Gilles Caulier
Comment 3 Ahmed Fathi 2017-03-05 20:27:17 UTC
Ok thanks, I will implement that and take a look at darktable's work
Ahmed
Comment 4 Ahmed Fathi 2017-03-12 17:37:23 UTC
Created attachment 104516 [details]
Patch to implement SVG watermark features

I made this simple patch for svg formated watermarks. The user is able to add a specific one-line text to the svg xml, and has the choice to insert today's date and/or the image name into the xml. He can choose the font size, text positions , and color for all of these, with appropriate default values.
Comment 5 caulier.gilles 2017-03-18 14:18:29 UTC
Ahmed,

I take a look into your patch, and i'm not agree with it.

1/ You patch DImg to handle SVG, but it's wrong. The type-mime enum from DIMg is to list supported file format with native decoder in DK core. SVG is support through QImage. That all.

2/ Your patch in watermark suppose that user know image as SVG. This will never work to non SVG image. BQM is dedicated to be fully automatic, that all.

3/ Your patch suppose that SVG image will be loaded in BQM through DIMG and patch XML as well. I think the basis of of this report is to apply a SVG over a raster image as a raster image (as users generate logo in Inkscape and watermark image with it). So loading SVG through QImage, render it as RGB and apply it over image is enough. The only problem is to support 16 bits color depth. So to solve it : load with DImg QImage loader, convert to 16 bits, apply to image.

4/ In other words, we don't support vector graphics images as well. This is not the goal of digiKam. We are raster graphic tools, that all. Patching XML contents in BQM is a wrong idea, else we will need to support it in editor too, and we don't want to make Inkscape here...

Please re-visit your patch. The solution here will be more simpler to achieve.

Gilles Caulier