|
| 1 | +--[[ |
| 2 | +
|
| 3 | + clear_GPS.lua - export and edit with GIMP |
| 4 | +
|
| 5 | + Copyright (C) 2016 Bill Ferguson <[email protected]>. |
| 6 | +
|
| 7 | + This program is free software: you can redistribute it and/or modify |
| 8 | + it under the terms of the GNU General Public License as published by |
| 9 | + the Free Software Foundation; either version 3 of the License, or |
| 10 | + (at your option) any later version. |
| 11 | +
|
| 12 | + This program is distributed in the hope that it will be useful, |
| 13 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + GNU General Public License for more details. |
| 16 | +
|
| 17 | + You should have received a copy of the GNU General Public License |
| 18 | + along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | +]] |
| 20 | +--[[ |
| 21 | + clear_GPS - clear GPS data from selected image(s) |
| 22 | +
|
| 23 | + This shortcut removes the GPS coordinate data from the selected images. |
| 24 | +
|
| 25 | + ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT |
| 26 | + * None |
| 27 | +
|
| 28 | + USAGE |
| 29 | + * require this script from your main lua file |
| 30 | + * select an image or images |
| 31 | + * click the shortcut, clear GPS data |
| 32 | +
|
| 33 | + BUGS, COMMENTS, SUGGESTIONS |
| 34 | + * Send to Bill Ferguson, [email protected] |
| 35 | +
|
| 36 | + CHANGES |
| 37 | +]] |
| 38 | + |
| 39 | +local dt = require "darktable" |
| 40 | +local gettext = dt.gettext |
| 41 | + |
| 42 | +-- not a number |
| 43 | +local NaN = 0/0 |
| 44 | + |
| 45 | +dt.configuration.check_version(...,{3,0,0}) |
| 46 | + |
| 47 | + |
| 48 | +-- Tell gettext where to find the .mo file translating messages for a particular domain |
| 49 | +gettext.bindtextdomain("clear_GPS",dt.configuration.config_dir.."/lua/") |
| 50 | + |
| 51 | +local function _(msgid) |
| 52 | + return gettext.dgettext("clear_GPS", msgid) |
| 53 | +end |
| 54 | + |
| 55 | +local function clear_GPS(images) |
| 56 | + for _, image in ipairs(images) do |
| 57 | + -- set the location information to Not a Number (NaN) so it displays correctly |
| 58 | + image.elevation = NaN |
| 59 | + image.latitude = NaN |
| 60 | + image.longitude = NaN |
| 61 | + end |
| 62 | +end |
| 63 | + |
| 64 | + |
| 65 | +dt.gui.libs.image.register_action( |
| 66 | + _("clear GPS data"), |
| 67 | + function(event, images) clear_GPS(images) end, |
| 68 | + "clear GPS data" |
| 69 | +) |
| 70 | + |
| 71 | +dt.register_event( |
| 72 | + "shortcut", |
| 73 | + function(event, shortcut) clear_GPS(dt.gui.action_images) end, |
| 74 | + "clear GPS data" |
| 75 | +) |
0 commit comments