For now, I’m using the watermark module to load custom (svg) guide lines, it works, but the problem with using the watermark module is the overlay is not shown when cropping (maybe this could be an option?), and I have to create ones for every aspect ratio.
ah, ok, I’m thinking of submitting a feature request on github for the watermark module to be shown when cropping if it’s possible (maybe not for the composition guides, but for a case like photographing for a magazine cover where they have a predetermined text layout), but I’m not sure if it’s suitable as it’s more of an overlay rather than watermarks.
ah I see, I’m not familiar with writing Lua, but maybe I can try learn it, is the code/example of built-in guides file/code also accessible in the installation directory?
my custom (composition) guides is basically a combination of grid and diagonal line, I thought it easier for me to learn by the example of the built-in guides because the passport example is using a position relative to a 36x47 rectangle.
It is a variation/simplification of the Dynamic Symmetry grid, quite similar to Rosarivo grid I often used in publication design. This is my go-to grid because it contains an intersection point of ROT, a center grid, and a diagonal grid, I also added a little Crossmark for the golden ratio intersection references.
Maybe these will come in handy, assuming for the moment that you don’t already created these yourself. 50 or so dynamic symmetry based, multi ratios PNGs. The lines are black (easily changed to any colour) and the backgrounds are fully transparent.
I use these at times in Krita. The only thing you need to do is scale them up/down.
This does not solve your current darktable request but it might save you some time and/or include ratios that you do not yet have.
here’s the script. If you have script manager place it into say guides dir and have a go:
--[[
Custom dynamic symmetry guide for darktable
copyright (c) 2021 Hubert Kowalski
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
darktable is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with darktable. If not, see <http://www.gnu.org/licenses/>.
]]
--[[
DYNAMIC SYMMETRY GUIDE
guide based on custom symmetry from Sandy Adriadi
https://discuss.pixls.us/t/add-custom-guides/26288/5?u=johnny-bit
INSTALLATION
* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory
* add the following line in the file $CONFIGDIR/luarc
require "dynamic_symmetry"
USAGE
* when using the cropping tool, select "dynamic symmetry" as guide
]]
local dt = require "darktable"
local du = require "lib/dtutils"
local gettext = dt.gettext
du.check_min_api_version("2.0.0", "dynamic_symmetry")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("dynamic_symmetry",dt.configuration.config_dir.."/lua/locale/")
local function _(msgid)
return gettext.dgettext("dynamic_symmetry", msgid)
end
dt.guides.register_guide("dynamic symmetry",
-- draw
function(cairo, x, y, width, height, zoom_scale)
cairo:save()
cairo:translate(x, y)
cairo:scale(width, height)
cairo:move_to(0,0)
cairo:line_to(1, 0.5)
cairo:line_to(0.5, 1)
cairo:line_to(0,0)
cairo:line_to(1, 1)
cairo:line_to(0.5, 0)
cairo:line_to(0, 0.5)
cairo:line_to(1, 1)
cairo:move_to(1, 0)
cairo:line_to(0, 0.5)
cairo:line_to(0.5, 1)
cairo:line_to(1, 0)
cairo:line_to(0, 1)
cairo:line_to(0.5, 0)
cairo:line_to(1, 0.5)
cairo:line_to(0, 1)
cairo:move_to(0,0.5)
cairo:line_to(1,0.5)
cairo:move_to(0.5,0)
cairo:line_to(0.5,1)
cairo:restore()
end,
-- gui
function()
return dt.new_widget("label"){label = _("dynamic symmetry"), halign = "start"}
end
)
WOW! I really can’t thank you enough for this @johnny-bit ! It perfectly works .
Now I have two example scripts for creating a grid and I think it will be easier now for me if I want to create another custom guides (i found and look at the code for built-in guides in the repository, but still not sure which function to call). The golden ratio is not really important, I can guess it visually or by looking at another point, it just a “nice to have” feature.
Thank you once again!
I’ve already created the PNG based image for the aspect ratio i often used, as i used it in another software too, but thank you nevertheless, those included variation will come in handy
Just a question though, is PNG can be used in dt’s watermarks?
No, but it’s not at all hard to use inkscape to import a png and export to svg. I don’t use these in darktable, but I did try when I made them and that works nicely.
I thought so, at first I tried using png and it didn’t work, thankfully I already have the vector-based guide in the vector editor I’ve used when doing design things.
Now that I’ve read the book again, yes you’re right, the correct name for this grid is the harmonic armature. I vaguely remember it that’s why I only write it as “variation/simplification”.
I’m interested in adding the dynamic symmetry, but the reason I’ve to choose this grid as my go-to grid is that it can be used in any aspect ratio. but I’ll try it as I want to learn a bit about LUA for adding custom grids.
If you need help we can help. Please do contribute your guides to GitHub - darktable-org/lua-scripts! If you need help I bet dt devs and @wpferguson especially will be happy to help
I am thinking to add PNG support to watermark module.
On top of custom overlays, the feature can be useful to put on Color palettes from Paletton or similar to use for color grading, without having to convert to SVG with Inkscape.
Stay tuned
That’s good news, if it’s possible, I’d like to see an option to show the overlay while cropping too (I’ve been hesitant to request it because it’s a “watermark” module, not an “overlay” module).
Here is the pull request.
Now there will be a review, but in the meantime you can test it.
when coming to crop, I am afraid this can’t be done with watermark module, which always come to the end of the pipeline