├── .github └── workflows │ └── main.yml ├── .gitignore ├── .vscode ├── c_cpp_properties.json └── launch.json ├── LICENSE ├── Makefile.am ├── Makefile.gimptool ├── README.Moire ├── README.md ├── bootstrap.sh ├── configure.ac ├── debian ├── compat ├── copyright ├── fourier-docs.docs ├── gimp2 │ ├── changelog │ └── control ├── gimp3 │ ├── changelog │ └── control ├── rules └── source │ └── format ├── fourier.c ├── po ├── Makefile.am ├── fr.po ├── gimp30-fourier.pot └── pt.po └── rpm ├── gimp-fourier-plugin.spec.in └── gimp3-fourier-plugin.spec.in /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [push,pull_request,workflow_dispatch] 3 | 4 | jobs: 5 | linux: 6 | runs-on: ubuntu-latest 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | include: [ 11 | {gimp: gimp2, apt: "libgimp2.0-dev", configure: "" }, 12 | # Disable linux build in CI until gimp3 is available in a runner build image (use ci_gimp3_linux branch to test) 13 | # {gimp: gimp3, apt: "libgimp-3.0-dev", configure: "--enable-gimp3-fourier" }, 14 | ] 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Create configure 18 | run: | 19 | sudo apt-get update -y 20 | sudo apt-get install autoconf automake libtool gcc libfftw3-dev ${{ matrix.apt }} 21 | autoreconf -i 22 | automake 23 | - name: Check configure & make with --disable-silent-rules 24 | run: | 25 | ./configure ${{ matrix.configure }} --disable-silent-rules 26 | make 27 | - name: Check install/uninstall/distcheck (with --disable-silent-rules) 28 | run: | 29 | make install-user 30 | make uninstall-user 31 | sudo make install 32 | sudo make uninstall 33 | make distcheck 34 | - name: Build deb package (with --enable-silent-rules) 35 | run: | 36 | make clean 37 | ./configure ${{ matrix.configure }} --enable-silent-rules 38 | make deb_${{ matrix.gimp }} 39 | cp ../gimp-plugin-fourier_* . 40 | - name: Build dist 41 | run: ./configure && make dist 42 | - uses: actions/upload-artifact@v4 43 | with: 44 | name: fourier_gimp_linux_${{ matrix.gimp }} 45 | path: | 46 | gimp-plugin-fourier_* 47 | gimp-plugin-fourier-*.tar.gz 48 | windows: 49 | strategy: 50 | fail-fast: false 51 | max-parallel: 2 52 | matrix: 53 | include: [ 54 | # {msystem: MINGW32, toolchain: mingw-w64-i686, version: x32, gimp: "gimp2", gimptool: "gimptool-2.0" }, 55 | # {msystem: MINGW64, toolchain: mingw-w64-x86_64, version: x64, gimp: "gimp2", gimptool: "gimptool-2.0" }, 56 | {msystem: MINGW32, toolchain: mingw-w64-i686, version: x32, gimp: "gimp3", gimptool: "gimptool" }, 57 | {msystem: MINGW64, toolchain: mingw-w64-x86_64, version: x64, gimp: "gimp3", gimptool: "gimptool" }, 58 | ] 59 | runs-on: windows-latest 60 | defaults: 61 | run: 62 | shell: msys2 {0} 63 | steps: 64 | - name: Install msys2 build environment 65 | uses: msys2/setup-msys2@v2 66 | with: 67 | msystem: ${{ matrix.msystem }} 68 | # update: false 69 | update: true 70 | install: base-devel git ${{ matrix.toolchain }}-toolchain ${{ matrix.toolchain }}-${{ matrix.gimp }} ${{ matrix.toolchain }}-fftw ${{ matrix.toolchain }}-gettext-tools 71 | 72 | - run: git config --global core.autocrlf input 73 | shell: bash 74 | 75 | - uses: actions/checkout@v4 76 | 77 | - name: Build plugin 78 | shell: msys2 {0} 79 | run: | 80 | echo $( ${{ matrix.gimptool }} -n --build fourier.c) -lfftw3 -O3 | sh 81 | mkdir -p artifacts/fourier 82 | cp fourier.exe artifacts/fourier/ 83 | cp `which libfftw3-3.dll` artifacts/fourier/ 84 | 85 | - name: Build locales 86 | if: ${{ matrix.gimp }} == "gimp3" 87 | shell: msys2 {0} 88 | run: | 89 | for L in fr pt; do mkdir -p artifacts/fourier/locale/$L/LC_MESSAGES/; msgfmt -c -v -o artifacts/fourier/locale/$L/LC_MESSAGES/gimp30-fourier.mo po/$L.po; done 90 | 91 | - name: Get GIMP version 92 | shell: msys2 {0} 93 | run: echo "GIMPVER=$(pacman -Q ${{ matrix.toolchain }}-${{ matrix.gimp }} | cut -d ' ' -f 2)" >> $GITHUB_ENV 94 | 95 | - uses: actions/upload-artifact@v4 96 | with: 97 | name: fourier_${{ matrix.version }}_gimp${{ env.GIMPVER }} 98 | # Using wildcard to force using fourier directory structure 99 | path: | 100 | artifacts/*/ 101 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specific 2 | fourier 3 | fourier-config.h 4 | fourier-config.h.in 5 | 6 | *.o 7 | *.spec 8 | *.tar.gz 9 | 10 | libtool 11 | /debian/.debhelper 12 | 13 | 14 | # From https://github.com/github/gitignore/blob/main/Autotools.gitignore 15 | 16 | # http://www.gnu.org/software/automake 17 | 18 | Makefile.in 19 | /ar-lib 20 | /mdate-sh 21 | /py-compile 22 | /test-driver 23 | /ylwrap 24 | .deps/ 25 | .dirstamp 26 | /.libs 27 | 28 | # http://www.gnu.org/software/autoconf 29 | 30 | autom4te.cache 31 | /autoscan.log 32 | /autoscan-*.log 33 | /aclocal.m4 34 | /compile 35 | /config.cache 36 | /config.guess 37 | /config.h.in 38 | /config.log 39 | /config.status 40 | /config.sub 41 | /configure 42 | /configure.scan 43 | /depcomp 44 | /install-sh 45 | /missing 46 | /stamp-h1 47 | 48 | # https://www.gnu.org/software/libtool/ 49 | 50 | /ltmain.sh 51 | 52 | # http://www.gnu.org/software/texinfo 53 | 54 | /texinfo.tex 55 | 56 | # http://www.gnu.org/software/m4/ 57 | 58 | m4/libtool.m4 59 | m4/ltoptions.m4 60 | m4/ltsugar.m4 61 | m4/ltversion.m4 62 | m4/lt~obsolete.m4 63 | 64 | # Generated Makefile 65 | # (meta build system like autotools, 66 | # can automatically generate from config.status script 67 | # (which is called by configure script)) 68 | Makefile 69 | 70 | fourier*.exe 71 | libfftw3*.dll 72 | *~ 73 | 74 | *.mo 75 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mingwpath": "${USERPROFILE}\\scoop\\apps\\msys2\\current\\mingw64", 4 | "myDefines": [] 5 | }, 6 | "configurations": [ 7 | { 8 | "name": "Linux", 9 | "includePath": [ 10 | "${workspaceFolder}/**", 11 | "/usr/include/gimp-2.0", 12 | "/usr/include/gdk-pixbuf-2.0", 13 | "/usr/include/cairo", 14 | "/usr/include/pixman-1", 15 | "/usr/include/uuid", 16 | "/usr/include/freetype2", 17 | "/usr/include/libpng16", 18 | "/usr/include/gegl-0.4", 19 | "/usr/include/gio-unix-2.0", 20 | "/usr/include/json-glib-1.0", 21 | "/usr/include/libmount", 22 | "/usr/include/blkid", 23 | "/usr/include/glib-2.0", 24 | "/usr/lib/x86_64-linux-gnu/glib-2.0/include", 25 | "/usr/include/babl-0.1" 26 | ], 27 | "defines": [], 28 | "compilerPath": "/usr/bin/gcc", 29 | "cStandard": "gnu17", 30 | "cppStandard": "gnu++14", 31 | "intelliSenseMode": "linux-gcc-x64" 32 | }, 33 | { 34 | "name": "mingw64", 35 | "includePath": [ 36 | "${workspaceFolder}/**", 37 | "${mingwpath}/include/gimp-2.0", 38 | "${mingwpath}/include/gimp-3.0", 39 | "${mingwpath}/include/cairo", 40 | "${mingwpath}/include/gegl-0.4", 41 | "${mingwpath}/include/glib-2.0", 42 | "${mingwpath}/include/babl-0.1", 43 | "${mingwpath}/include/gdk-pixbuf-2.0", 44 | "${mingwpath}/lib/glib-2.0/include" 45 | ], 46 | "defines": [ 47 | "_DEBUG", 48 | "UNICODE", 49 | "_UNICODE" 50 | ], 51 | "windowsSdkVersion": "10.0.22000.0", 52 | "compilerPath": "${mingwpath}/bin/gcc.exe", 53 | "cStandard": "c17", 54 | "cppStandard": "c++17", 55 | "intelliSenseMode": "linux-gcc-x64" 56 | } 57 | ], 58 | "version": 4 59 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "(gdb) Attach", 9 | "type": "cppdbg", 10 | "request": "attach", 11 | "program": "/home/remi/.config/GIMP/2.10/plug-ins/fourier/fourier", 12 | "MIMode": "gdb", 13 | "setupCommands": [ 14 | { 15 | "description": "Do not stop on signals", 16 | "text": "handle all nostop", 17 | "ignoreFailures": true 18 | }, 19 | { 20 | "description": "Do not stop on exceptions", 21 | "text": "catch throw", 22 | "ignoreFailures": true 23 | }, 24 | { 25 | "description": "Enable pretty-printing for gdb", 26 | "text": "-enable-pretty-printing", 27 | "ignoreFailures": true 28 | }, 29 | { 30 | "description": "Set Disassembly Flavor to Intel", 31 | "text": "-gdb-set disassembly-flavor intel", 32 | "ignoreFailures": true 33 | } 34 | ] 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - Top level automakefile for fourier 2 | 3 | SUBDIRS = . 4 | 5 | # The braces around ACLOCAL_FLAGS below instead of parentheses are intentional! 6 | # Otherwise autoreconf misparses the line. 7 | ACLOCAL_AMFLAGS=-I m4 ${ACLOCAL_FLAGS} 8 | AM_CFLAGS = ${CFLAGS} ${CPPFLAGS} ${FFTW_CFLAGS} 9 | 10 | fourier_SOURCES = fourier.c 11 | fourier.$(OBJEXT): fourier-config.h 12 | fourier_LDADD = ${LIBS} ${FFTW_LIBS} 13 | fourier_CFLAGS = 14 | GIMPTOOL = 15 | 16 | bin2_PROGRAMS = 17 | bin2dir = 18 | if MAKEGIMP2 19 | bin2_PROGRAMS += fourier 20 | bin2dir += $(GIMP2_BINDIR)/plug-ins 21 | fourier_LDADD += ${GIMP2_LIBS} ${GTK2_LIBS} 22 | fourier_CFLAGS += ${GIMP2_CFLAGS} ${GTK2_CFLAGS} -DMAKE_FOR_GIMP3=0 23 | GIMPTOOL += ${GIMPTOOL2} 24 | endif 25 | 26 | bin3_PROGRAMS = 27 | bin3dir = 28 | if MAKEGIMP3 29 | SUBDIRS += po 30 | bin3_PROGRAMS += fourier 31 | # 'make distcheck' can't write to ${GIMP3_LIBDIR}/plug-ins/fourier because of 32 | # directory permissions, therefore don't install fourier unless you are root. 33 | # bin3dir += $(GIMP3_BINDIR)/plug-ins/fourier 34 | @SNIPPET1@ 35 | fourier_LDADD += ${GIMP3_LIBS} ${GTK3_LIBS} 36 | fourier_CFLAGS += ${GIMP3_CFLAGS} ${GTK3_CFLAGS} -DMAKE_FOR_GIMP3=1 37 | GIMPTOOL += ${GIMPTOOL3} 38 | endif 39 | 40 | # Avoid using this line below (Dirs gimp-plugin-fourier vs gimp-fourier-plugin). 41 | #doc_DATA = README.md README.Moire 42 | 43 | EXTRA_DIST = LICENSE Makefile.gimptool \ 44 | bootstrap.sh README.md README.Moire \ 45 | debian/gimp2/changelog debian/gimp2/control \ 46 | debian/gimp3/changelog debian/gimp3/control \ 47 | debian/compat debian/copyright \ 48 | debian/fourier-docs.docs debian/rules \ 49 | debian/source/format \ 50 | rpm/gimp-fourier-plugin.spec.in \ 51 | rpm/gimp3-fourier-plugin.spec.in 52 | nodist_EXTRA_DATA = .git .github .deps .libs 53 | DISTCHECK_CONFIGURE_FLAGS = --disable-silent-rules --enable-silent-rules 54 | if MAKEGIMP3 55 | DISTCHECK_CONFIGURE_FLAGS += --enable-fourier_dialog 56 | endif 57 | 58 | strip: 59 | $(STRIP) ${builddir}/fourier 60 | 61 | # These use gimptool to install/uninstall fourier in user directory 62 | install-user: 63 | $(GIMPTOOL) --install-bin ${builddir}/fourier 64 | 65 | uninstall-user: 66 | $(GIMPTOOL) --uninstall-bin fourier 67 | 68 | deb_gimp2: 69 | cp -f debian/gimp2/* debian 70 | export DEB_CONFIGURE_EXTRA_FLAGS="" 71 | dpkg-buildpackage -b -rfakeroot -us -uc 72 | dpkg-buildpackage -rfakeroot -Tclean 73 | 74 | deb_gimp3: 75 | cp -f debian/gimp3/* debian 76 | export DEB_CONFIGURE_EXTRA_FLAGS="--enable-gimp3-fourier" 77 | dpkg-buildpackage -b -rfakeroot -us -uc 78 | dpkg-buildpackage -rfakeroot -Tclean 79 | -------------------------------------------------------------------------------- /Makefile.gimptool: -------------------------------------------------------------------------------- 1 | # Older version of Makefile before autotools versions. 2 | # You may try this one if the autotools version does not work. 3 | 4 | # Use gimptool-2.0 to set these variables 5 | GIMPTOOL=gimptool-2.0 6 | PLUGIN_BUILD=$(GIMPTOOL) --build 7 | PLUGIN_INSTALL=$(GIMPTOOL) --install-bin 8 | GCC=gcc 9 | LIBS=$(shell pkg-config fftw3 gimp-2.0 --libs) -lm 10 | CFLAGS=-O2 $(shell pkg-config fftw3 gimp-2.0 --cflags) 11 | VERSION=0.4.3 12 | DIR=fourier-$(VERSION) 13 | 14 | export 15 | 16 | FILES= \ 17 | fourier.c \ 18 | Makefile \ 19 | Makefile.win \ 20 | README \ 21 | README.Moire \ 22 | fourier.dev 23 | 24 | all: fourier 25 | 26 | # Use of pkg-config is the recommended way 27 | fourier: fourier.c 28 | $(GCC) $(CFLAGS) -o fourier fourier.c $(LIBS) 29 | 30 | # To avoid gimptool use, just copy the fourier in the directory you want 31 | install: fourier 32 | $(PLUGIN_INSTALL) fourier 33 | 34 | dist: 35 | mkdir $(DIR) 36 | cp $(FILES) $(DIR) 37 | tar czf "$(DIR).tar.gz" $(DIR) 38 | rm -Rf $(DIR) 39 | 40 | clean: 41 | rm -f fourier 42 | -------------------------------------------------------------------------------- /README.Moire: -------------------------------------------------------------------------------- 1 | This plug-in to Gimp does a FFT of an image. 2 | 3 | I've used this with success to remove moiré patterns from 4 | images scanned from books: 5 | 6 | The image should be in RGB. Remove the alpha layer, 7 | this makes it easier (Layers|Flatten image). 8 | 9 | Select Filters|Render|FFT directe 10 | 11 | In the Layers window, select the layer, and "Duplicate Layer". 12 | 13 | Select Image|Colors|Brightness-Contrast. Increase Contrast so 14 | you can see the patterns. 15 | 16 | The area in the upper left and upper right is the FFT of the 17 | real image; don't modify this. The FFT of the moiré pattern 18 | is outside these regions. Use the Rectangular Selection or 19 | Elliptical Selection tools to select these regions. 20 | 21 | Remove the copy layer: This will leave the original FFT 22 | image with the selections. 23 | 24 | Choose (128,128,128) as the background color. 25 | 26 | Select Edit|Fill with BG color. 27 | 28 | Remove the selections from the image. 29 | 30 | Select Filters|Render|FFT inverse 31 | 32 | Voilà, now you have an image without the moiré pattern! 33 | 34 | It was originally written by Rémi Peyronnet , 35 | I have corrected a few bugs in it. 36 | 37 | Files: 38 | 39 | gpplugin.tar.gz: Contains these files: 40 | gpplugin.c: The source code 41 | Makefile: The Makefile 42 | README: This file 43 | 44 | Mogens Kjaer 45 | mk@crc.dk 46 | May 5, 2002 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![CI](https://github.com/rpeyron/plugin-gimp-fourier/actions/workflows/main.yml/badge.svg)](https://github.com/rpeyron/plugin-gimp-fourier/actions/workflows/main.yml) 2 | [![Packaging status](https://repology.org/badge/tiny-repos/gimp:fourier.svg)](https://repology.org/project/gimp:fourier/versions) 3 | 4 | # plugin-gimp-fourier 5 | 6 | Fourier plugin for GIMP _(compatible with GIMP2.2 and GIMP3.0)_ 7 | 8 | [Use](#use) | [Install on Windows](#windows) | [Install on Linux](#linux) | [Install from source](#installation-from-source-code) | [Maintainers instructions](#maintainers) | [History & Thanks](#history) 9 | 10 | ## What it does 11 | 12 | It does a direct and reverse Fourier Transform. 13 | It allows you to work in the frequency domain. 14 | For instance, it can be used to remove moiré patterns from images scanned from books. (See [README.Moire](README.Moire)) 15 | 16 | ## Use 17 | 18 | It adds 2 items in the filters menu: 19 | * Filters/Generic/FFT Forward 20 | * Filters/Generic/FFT Inverse 21 | 22 | ![image](https://user-images.githubusercontent.com/3126751/121738126-19e4ec80-cafa-11eb-9fec-ad923d853cde.png) 23 | 24 | 25 | ## Installation of pre-built binaries 26 | 27 | ### Windows 28 | 29 | Binaries for windows are provided as separate packages. Please download the 32bits or 64bits according to you GIMP version 30 | (this is not related to Windows version). Altough the GIMP API is quite stable, the binaries are not, and the plugin binaries 31 | must be updated to new GIMP versions (some will work, some won't). The GIMP version is indicated in the package filename. 32 | Download the binaries that fits the best to your GIMP version. Just copy the fourier folder (containing fourier.exe and libfftw3-3.dll) 33 | in the plugins directory of either: 34 | - your personal gimp directory (ex: .gimp-2.2\plug-ins or .gimp-3.0\plug-ins), 35 | - or in the global directory (C:\Program Files\GIMP-2.2\lib\gimp\2.0\plug-ins or C:\Program Files\GIMP-3.0\lib\gimp\3.0\plug-ins) 36 | 37 | ### Linux 38 | 39 | - Fedora repository: `sudo yum install gimp-fourier-plugin` (by the Fedora community) 40 | - Debian/Ubuntu pre-built package: download the deb file and install with `sudo dpkg -i gimp-plugin-fourier_0.4.5-1_amd64.deb` 41 | - and other distributions like openSUSE, slack, ArchLinux, Enterprise Linux, Guix and NixOS by experimental packages by their communities (see [repology list](https://repology.org/project/gimp:fourier/versions)). 42 | 43 | 44 | 45 | ## Installation from source code 46 | 47 | [Windows GIMP3](#windows---gimp3) | [Windows GIMP2](#windows---gimp2) | [Linux GIMP3](#linux---gimp3) | [Linux GIMP2](#linux---gimp2) 48 | 49 | You will need the fftw3 package, and the development packages of gimp, fftw3, and glib. 50 | You may use the autotools build system, or use the simplified gimptool build system. 51 | 52 | ### Windows - GIMP3 53 | 54 | To build with msys2 environment: 55 | ``` 56 | msys2 -c "pacman -Suy" 57 | msys2 -c "pacman -S --noconfirm mingw-w64-x86_64-toolchain" 58 | msys2 -c "pacman -S --noconfirm mingw-w64-x86_64-gimp3" 59 | msys2 -c "pacman -S --noconfirm mingw-w64-x86_64-fftw" 60 | msys2 -mingw64 -c 'echo $(gimptool-3.0 -n --build fourier.c) -lfftw3 -O3 | sh' 61 | msys2 -mingw64 -c 'cp `which libfftw3-3.dll` .' 62 | msys2 -c "pacman -Scc" 63 | ``` 64 | 65 | 66 | ### Windows - GIMP2 67 | 68 | Note: with the release of GIMP 3.0, GIMP 2 have been removed from msys2 69 | 70 | To build with msys2 environment: 71 | ``` 72 | msys2 -c "pacman -Suy" 73 | msys2 -c "pacman -S --noconfirm mingw-w64-x86_64-toolchain" 74 | msys2 -c "pacman -S --noconfirm mingw-w64-x86_64-gimp=2.10.36" 75 | msys2 -c "pacman -S --noconfirm mingw-w64-x86_64-fftw" 76 | msys2 -mingw64 -c 'echo $(gimptool-2.0 -n --build fourier.c) -lfftw3 -O3 | sh' 77 | msys2 -mingw64 -c 'cp `which libfftw3-3.dll` .' 78 | msys2 -c "pacman -Scc" 79 | ``` 80 | 81 | To build with ./configure and xgettext: 82 | ``` 83 | msys2 -c "pacman -S --noconfirm mingw-w64-x86_64-autotools" 84 | msys2 -c "pacman -S --noconfirm mingw-w64-x86_64-gettext-tools" 85 | ``` 86 | 87 | This is for 64bits version ; replace x86_64 by i686 and -mingw64 by -mingw32 if you want 32bits. 88 | Replace also 2.10.36 by your GIMP version (or leave empty for latest version) 89 | 90 | Also, the windows binaries are built through GitHub Actions, so you may also fork this repository and build the plugin on your own. 91 | 92 | ### Linux - GIMP3 93 | 94 | The gimp3 version is built with `--enable-gimp3-fourier` configure option. 95 | 96 | You will need the fftw3 package, and the development packages of gimp, fftw3, and glib 97 | For instance, on debian/ubuntu : `sudo apt-get install libfftw3-dev libgimp-3.0-dev` 98 | 99 | Then if you cloned this repo, starts with the commands below. 100 | If you downloaded the tar package, you may skip this step and go to the second one. 101 | ```sh 102 | autoreconf -i (or use 'autoreconf --install --force' for more modern setups) 103 | automake --foreign -Wall 104 | ``` 105 | 106 | And then: 107 | ```sh 108 | ./configure --enable-gimp3-fourier 109 | make 110 | make strip 111 | sudo make install 112 | ``` 113 | 114 | 115 | ### Linux - GIMP2 116 | 117 | You will need the fftw3 package, and the development packages of gimp, fftw3, and glib 118 | For instance, on debian/ubuntu : `sudo apt-get install libfftw3-dev libgimp2.0-dev` 119 | 120 | Then if you cloned this repo, starts with the commands below. 121 | If you downloaded the tar package, you may skip this step and go to the second one. 122 | ```sh 123 | autoreconf -i (or use 'autoreconf --install --force' for more modern setups) 124 | automake --foreign -Wall 125 | ``` 126 | 127 | And then: 128 | ```sh 129 | ./configure 130 | make 131 | make strip 132 | sudo make install 133 | ``` 134 | 135 | If you have non-standard GIMP plug-ins directory, you may have to add `--bindir=/usr/lib/gimp/2.0/plug-ins` to the configure command (replace by your plug-ins path) 136 | 137 | ## Release notes for GIMP3 138 | 139 | A simple port have been made. It does not currently use the new features of GIMP3. 140 | I am waiting for the GIMP3 plugin developer documentation (not available yet), to see if a rewrite 141 | with new standards and features will be useful or not. 142 | 143 | The plugin is unified can now be compiled for both GIMP2 or GIMP3 144 | (the gimptool maybe named differently depending on your distribution). 145 | There are draft versions with seperate plugins or with includes in the git history. 146 | The GIMP3 part have been adapted from the `hot.c` bundled plugin 147 | 148 | Note that plugin must be in a folder, and plugin exe must have the same name as the folder 149 | 150 | To install GIMP3 dev packages on mingw64: 151 | - Use package `mingw-w64-x86_64-gimp3` instead of `mingw-w64-x86_64-gimp3` ; you will need to uninstall GIMP2 dev packages before as there is some file conflicts: `msys2 -c "pacman -R --noconfirm mingw-w64-x86_64-gimp && pacman -S --noconfirm mingw-w64-x86_64-gimp3"` 152 | - To switch back to GIMP2 dev packages: `msys2 -c "pacman -R --noconfirm mingw-w64-x86_64-gimp3 && pacman -S --noconfirm mingw-w64-x86_64-gimp"` 153 | 154 | The configure script has been made compatible to build both gimp2 and gimp3 version. For now, as GIMP3 has not been released, the default is to build GIMP2 plugin, even on 155 | the gimp2.99 branch. To switch tobuild the GIMP3 plugin with configure, use the option `--enable-gimp3-fourier`: 156 | ``` 157 | ./configure --enable-gimp3-fourier 158 | make 159 | make strip 160 | sudo make install 161 | ``` 162 | 163 | 164 | ## Maintainers 165 | 166 | To create a distributable gimp-plugin-fourier-{version}.tar.gz file, you will need to do these steps: 167 | First, update the MAJOR.MINOR version in configure.ac, and then: 168 | 169 | ``` 170 | $ wget -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' 171 | $ wget -O config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' 172 | $ autoreconf -i 173 | $ automake --foreign -Wall 174 | $ ./configure 175 | $ make dist 176 | $ ls -l 177 | ``` 178 | You should see a tar file named gimp-fourier-plugin-0.4.4.tar.gz in the same directory. 179 | To verify that the dist package contains all files and nothing is missing, test build it.... 180 | ``` 181 | $ tar -xzf gimp-fourier-plugin-0.4.4.tar.gz 182 | $ cd gimp-fourier-plugin-0.4.4 183 | $ ./configure --bindir=/usr/lib/gimp/2.0/plug-ins 184 | $ make 185 | $ sudo make install 186 | ``` 187 | If no errors, then copy gimp-fourier-plugin-0.4.4.tar.gz to your release webpage. 188 | NOTE: rpm spec file Source0 URL links to this file. 189 | 190 | ## Debug 191 | 192 | * Build & install `make clean && make && make install-user` 193 | * Run Gimp `GIMP_PLUGIN_DEBUG=fourier,run gimp` 194 | * Run plugin 195 | * Attach fourier process to gdb (in vscode with debug gdb) 196 | 197 | Note: optimization removes some variables and add some difficulties to debug, but I did not manage to get the plugin to compille with -O0 (getting link errors with local functions...) 198 | 199 | ## Packaging 200 | 201 | You should always use packages of your distribution. 202 | 203 | Sample debian & rpm specification files are provided in this repository. Those files can be useful as a guide for distribution maintainers for their first version or notable changes but are not reference for all distributions. 204 | 205 | If you want to build a package for yourself, to test that it works as should work, you can follow the information below 206 | 207 | ### Debian package 208 | 209 | See tutorial here: https://www.debian.org/doc/devel-manuals#packaging-tutorial 210 | 211 | And run: 212 | ``` 213 | ./configure 214 | make deb 215 | ``` 216 | 217 | ### rpm package 218 | 219 | See reference here: https://wiki.mageia.org/en/Packagers_RPM_tutorial 220 | 221 | What you would need to do is: 222 | - `make dist` or `make distcheck` 223 | - copy the .tar.gz file into the ~/rpmbuild/SOURCES/ directory 224 | - copy the rpm/.rpm file into the ~/rpmbuild/SPECS/ directory 225 | - run `rpmbuild -ba ~/rpmbuilds/SPECS/gimp*-fourier-plugin.rpm` 226 | 227 | ## History 228 | 229 | ``` 230 | * (Nov 2024): merged GIMP3 version with 3.0rc1 publication (but plugin code is still iso) 231 | * (May 2024): first version of GIMP3 compatibility (iso) 232 | * v0.4.5 (Mar 2024): fix selection overflow ([#6](https://github.com/rpeyron/plugin-gimp-fourier/issues/6)) 233 | * v0.4.4 (Aug 2022): 234 | - Replaced deprecated functions 235 | - Autotools toolchain and initial_rpm.spec file by Joe Da Silva 236 | - Github action workflow to build gimp-fourier-plugin 237 | * v0.4.3 (Apr 2014); Makefile patch by bluedxca93 (-lm arg for ubuntu 13.04) 238 | * v0.4.2 (Feb 2012); Makefile patch by Bob Barry (gcc arg order) 239 | * v0.4.1 (Jan 2010): Patch by Martin Ramshaw 240 | - Select Gray after transform + doc 241 | * v0.4.0 (Oct 2009): Patch by Edgar Bonet 242 | - No Fourier coefficient is lost 243 | - Reordered the data in a more natural way 244 | * v0.3.2 (Feb 2009): 245 | - Officialized distribution under GPL 246 | - Fixed Makefile by using pkg-config instead of gimptool 247 | * v0.3.1 (Dec 2007): 248 | - Zero initialize padding by Rene Rebe 249 | - Windows compatibility, inverse remove parasite, cosmetics (Mar 2005) 250 | * v0.3.0 (Aug 2005): dynamic boosting from Alex Fernández 251 | - Dynamic boosted normalization : loss of quality is now un-noticeable 252 | - Removed the need of parasite information 253 | * v0.2.0 (Mar 2005): Many improvements from Mogens Kjaer 254 | - Moved to gimp-2.2 255 | - Handles RGB and grayscale images 256 | - Scale factors stored as parasite information 257 | - Columns are swapped 258 | * v0.1.3 (Oct 2004): Moved to gimp-2.0 (Linux only) 259 | * v0.1.2 (May 2002): Minor modifications by Mogens Kjaer 260 | * v0.1.1 (Feb 2022): First release of this plugin 261 | 262 | ``` 263 | 264 | Many thanks to Mogens Kjaer, Alex Fernández, Rene Rebe, Edgar Bonet, 265 | Martin Ramshaw, Bob Barry, bluedxca93 and Joe Da Silva for their contributions. 266 | 267 | French readers may also interested by [this article](https://www.lprp.fr/2002/02/fourier/) that describes 268 | the way the plugin works (even it is a little outdated as a GIMP parasite is used to store the scale 269 | factor instead of the former 'magic pixel') 270 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | # From https://github.com/rpeyron/plugin-gimp-fourier/pull/2 - DO NOT AUTOMATE 2 | 3 | wget -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' 4 | wget -O config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' 5 | autoreconf -i 6 | automake 7 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | dnl Process this file with "autoreconf -i;automake" to produce a configure script. 3 | 4 | # Copyright (C) 2022 by Joe Da Silva 5 | 6 | AC_PREREQ([2.68]) 7 | #-------------------------------------------------------------------------- 8 | # Setup variables before running AC_INIT() 9 | # 10 | # Making point releases: 11 | # fourier_major_version += 0; 12 | # fourier_minor_version += 1; (patches or added function(s)) 13 | # 14 | # If any new functions have been added: 15 | # fourier_major_version += 0; 16 | # fourier_minor_version += 1; (added function(s)) 17 | # 18 | # If backwards compatibility has been broken: 19 | # fourier_major_version += 1; 20 | # fourier_minor_version = 0; 21 | # 22 | m4_define([fourier_major_version], [0.4]) 23 | m4_define([fourier_minor_version], [5]) 24 | m4_define([fourier_version],[fourier_major_version.fourier_minor_version]) 25 | m4_define([fourier_package_name], [gimp-plugin-fourier]) 26 | m4_define([fourier_package_home], [https://www.lprp.fr/gimp_plugin_en/]) 27 | m4_define([fourier_package_email], [https://github.com/rpeyron/plugin-gimp-fourier/issues]) 28 | 29 | #-------------------------------------------------------------------------- 30 | AC_INIT([fourier],[fourier_version],[fourier_package_email], 31 | [fourier_package_name],[fourier_package_home]) 32 | # old registry location was: http://registry.gimp.org/node/19596 33 | #-------------------------------------------------------------------------- 34 | AC_CONFIG_SRCDIR([fourier.c]) 35 | AC_CONFIG_MACRO_DIR([m4]) 36 | AC_CANONICAL_HOST 37 | AC_CANONICAL_BUILD 38 | AC_USE_SYSTEM_EXTENSIONS 39 | AM_INIT_AUTOMAKE([foreign -Wall]) 40 | 41 | #-------------------------------------------------------------------------- 42 | # automake 1.12 needs AM_PROG_AR but automake < 1.11.2 doesn't recognize it 43 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 44 | 45 | LT_INIT 46 | AC_SUBST([LIBTOOL_DEPS]) 47 | 48 | #-------------------------------------------------------------------------- 49 | # Checks for programs. 50 | AC_PROG_CC 51 | AC_PROG_GREP 52 | AC_PROG_SED 53 | AC_PROG_LN_S 54 | AC_PROG_MKDIR_P 55 | AC_PATH_PROG([STRIP],[strip],[:]) 56 | AC_PATH_PROG([GIMPTOOL2],[gimptool-2.0],[:]) 57 | AC_CHECK_PROGS([GIMPTOOL3],[gimptool-3.0],[:]) 58 | AC_PATH_PROG([MSGFMT],[msgfmt],[:]) 59 | AC_PATH_PROG([MSGINIT],[msginit],[:]) 60 | AC_PATH_PROG([MSGMERGE],[msgmerge],[:]) 61 | AC_PATH_PROG([XGETTEXT],[xgettext],[:]) 62 | AM_CONFIG_HEADER(fourier-config.h) 63 | AC_PROG_INSTALL 64 | AC_PROG_MAKE_SET 65 | 66 | #-------------------------------------------------------------------------- 67 | # Enable silent build rules by default, this requires atleast Automake-1.11 68 | # Disable by passing --disable-silent-rules to configure or using make V=1 69 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],[AC_SUBST([AM_DEFAULT_VERBOSITY],[1])]) 70 | 71 | #-------------------------------------------------------------------------- 72 | # The following is for benefit of links using paths relative to top_srcdir. 73 | CPPFLAGS="${CPPFLAGS} AS_ESCAPE([-I${top_builddir}]) AS_ESCAPE([-I${top_srcdir}])" 74 | 75 | #-------------------------------------------------------------------------- 76 | # Check for required libraries. 77 | # NOTE: Some distros don't have /usr/local included in the /etc/ld.so PATH, 78 | # so, PKG_CHECK_MODULES may not find libraries you compile into /usr/local, 79 | # therefore use AC_SEARCH_LIBS, AC_CHECK_FUNC for backup. 80 | 81 | # Check for math.h include and math library (some OSes have -lm built-in). 82 | have_libm=maybe 83 | AC_CHECK_HEADER([math.h], 84 | AC_SEARCH_LIBS([cos],[m],[have_libm=yes], 85 | AC_CHECK_FUNC([cos],[have_libm=yes]))) 86 | if test x"${have_libm}" != xyes; then 87 | AC_MSG_FAILURE([ERROR: Please install the Math library and math.h],[1]) 88 | fi 89 | 90 | # Check for package fftw, else fftw3.h include file and fftw3 library. GPL 91 | have_libfftw=maybe 92 | PKG_CHECK_MODULES([FFTW],[fftw3 >= 3.0],[have_libfftw=yes],[have_libfftw=no]) 93 | if test x"${have_libfftw}" != xyes; then 94 | AC_CHECK_HEADER([fftw3.h], 95 | AC_SEARCH_LIBS([fftw_plan_dft_r2c_2d],[fftw3],[have_libfftw=yes], 96 | AC_CHECK_FUNC([fftw_plan_dft_r2c_2d],[have_libfftw=yes]))) 97 | fi 98 | if test x"${have_libfftw}" != xyes; then 99 | AC_MSG_FAILURE([ERROR: Please install the developer version of fftw3 library.],[1]) 100 | fi 101 | AC_SUBST(FFTW_CFLAGS) 102 | AC_SUBST(FFTW_LIBS) 103 | 104 | #-------------------------------------------------------------------------- 105 | # Enable fourier dialog mode 106 | AC_ARG_ENABLE([fourier_dialog], 107 | [AS_HELP_STRING([--enable-fourier_dialog], 108 | [Enable fourier_dialog mode @<:@default=no@:>@])], 109 | [],[enable_fourier_dialog=no]) 110 | if test "x$enable_fourier_dialog" = xyes || test "x$enable_fourier_dialog" = xtrue ; then 111 | AC_DEFINE([FOURIER_USE_DIALOG],1,[experimental, Define if using GIMP-3.0 style dialog.]) 112 | fi 113 | 114 | #-------------------------------------------------------------------------- 115 | # Enable make gimp3-plugin-fourier, and turn-off making gimp-plugin-fourier 116 | AC_ARG_ENABLE([gimp3_fourier], 117 | [AS_HELP_STRING([--enable-gimp3-fourier], 118 | [Enable gimp3-fourier, and disable gimp-fourier mode @<:@default=no@:>@])], 119 | [gimp3_fourier=yes],[gimp3_fourier=no]) 120 | make_gimp2=yes 121 | make_gimp3=no 122 | if test "x$gimp3_fourier" = xyes || test "x$gimp3_fourier" = xtrue ; then 123 | make_gimp2=no 124 | make_gimp3=yes 125 | fi 126 | AM_CONDITIONAL([MAKEGIMP2],[test "${make_gimp2}"x = yesx]) 127 | AM_CONDITIONAL([MAKEGIMP3],[test "${make_gimp3}"x = yesx]) 128 | 129 | #-------------------------------------------------------------------------- 130 | # Check for libraries based on ./configure --enable choices. 131 | 132 | # Check for libgimp2/gimp.h include file and libgimp library. LGPL 133 | GIMP2_CFLAGS= 134 | GIMP2_LIBS= 135 | GIMP2_BINDIR= 136 | if test x"${make_gimp2}" = xyes; then 137 | have_libgimp2=no 138 | PKG_CHECK_MODULES([GIMP2], 139 | [gimp-2.0 >= 2.10.0 gimpui-2.0 >= 2.10.0],[have_libgimp2=yes]) 140 | if test x"${have_libgimp2}" != xyes; then 141 | AC_MSG_FAILURE([ERROR: Please install the developer version of libgimp2.],[1]) 142 | fi 143 | # Pass GIMP_LIBDIR to automake for default GIMP plug-ins directory 144 | gimp2_gimplibdir=`${PKG_CONFIG} --variable=gimplibdir gimp-2.0` 145 | gimp2_prefix=`${PKG_CONFIG} --variable=exec_prefix gimp-2.0` 146 | gimp2_relative=${gimp2_gimplibdir#$gimp2_prefix} 147 | GIMP2_BINDIR=\${exec_prefix}"$gimp2_relative" 148 | fi 149 | AC_SUBST(GIMP2_CFLAGS) 150 | AC_SUBST(GIMP2_LIBS) 151 | AC_SUBST(GIMP2_BINDIR) 152 | 153 | AM_CONDITIONAL([HAVEGIMPTOOL2],[test "${GIMPTOOL2}"x != x]) 154 | 155 | # Fetch necessary flags for building gimp2 version of gimp-plugin-fourier 156 | GTK2_CFLAGS= 157 | GTK2_LIBS= 158 | if test x"${make_gimp2}" = xyes; then 159 | have_libgtk=no 160 | PKG_CHECK_MODULES([GTK2],[gtk+-2.0],[have_libgtk=yes]) 161 | if test x"${have_libgtk}" != xyes; then 162 | AC_MSG_FAILURE([ERROR: Please install the developer version of libgtk+2.],[1]) 163 | fi 164 | fi 165 | AC_SUBST(GTK2_CFLAGS) 166 | AC_SUBST(GTK2_LIBS) 167 | 168 | # Check for libgimp3/gimp.h include file and libgimp library. LGPL 169 | GIMP3_CFLAGS= 170 | GIMP3_LIBS= 171 | GIMP3_BINDIR= 172 | SNIPPET1= 173 | if test x"${make_gimp3}" = xyes; then 174 | have_libgimp3=no 175 | PKG_CHECK_MODULES([GIMP3],[gimp-3.0 gimpui-3.0],[have_libgimp3=yes]) 176 | if test x"${have_libgimp3}" != xyes; then 177 | AC_MSG_FAILURE([ERROR: Please install the developer version of libgimp3.],[1]) 178 | fi 179 | # Pass GIMP_LIBDIR to automake for default GIMP plug-ins directory 180 | gimp3_gimplibdir=`${PKG_CONFIG} --variable=gimplibdir gimp-3.0` 181 | gimp3_prefix=`${PKG_CONFIG} --variable=exec_prefix gimp-3.0` 182 | gimp3_relative=${gimp3_gimplibdir#$gimp3_prefix} 183 | GIMP3_BINDIR=\${exec_prefix}"$gimp3_relative" 184 | dnl Do it here since automake can't process 'if/else/endif in Makefile.am 185 | GIMP3_BINDIR=${gimp3_gimplibdir}/plug-ins/fourier 186 | SNIPPET1=' 187 | ifeq ($(shell id -u),0) 188 | bin3dir += $(GIMP3_BINDIR) 189 | else 190 | bin3dir += $(libdir)/gimp/3.0/plug-ins/fourier 191 | endif 192 | ' 193 | fi 194 | AC_SUBST(GIMP3_CFLAGS) 195 | AC_SUBST(GIMP3_LIBS) 196 | AC_SUBST(GIMP3_BINDIR) 197 | AC_SUBST([SNIPPET1]) 198 | AM_SUBST_NOTMAKE([SNIPPET1]) 199 | 200 | AM_CONDITIONAL([HAVEGIMPTOOL3],[test "${GIMPTOOL3}"x != x]) 201 | 202 | # Fetch necessary flags for building gimp3 version of gimp-plugin-fourier 203 | GTK3_CFLAGS= 204 | GTK3_LIBS= 205 | if test x"${make_gimp3}" = xyes; then 206 | have_libgtk3=no 207 | PKG_CHECK_MODULES([GTK3],[gtk+-3.0],[have_libgtk3=yes]) 208 | if test x"${have_libgtk3}" != xyes; then 209 | AC_MSG_FAILURE([ERROR: Please install the developer version of libgtk+3.],[1]) 210 | fi 211 | fi 212 | AC_SUBST(GTK3_CFLAGS) 213 | AC_SUBST(GTK3_LIBS) 214 | 215 | # Avoid being locked to a particular gettext verion, use what's available. 216 | have_gettext=no 217 | GETTEXT_PACKAGE3=gimp30-fourier 218 | if test x"${make_gimp3}" = xyes; then 219 | AC_CHECK_HEADERS([intl.h],[have_gettext=yes]) 220 | AC_CHECK_FUNC([gettext],[have_gettext=yes],[have_gettext=no]) 221 | AC_CHECK_FUNC([bind_textdomain_codeset],,[have_gettext=no]) 222 | AC_CHECK_FUNC([textdomain],,[have_gettext=no]) 223 | if test x"${have_gettext}" = xno; then 224 | AC_SEARCH_LIBS([intl],[have_gettext=yes],[ 225 | AC_MSG_ERROR([ERROR: gettext() required! Please install libintl or GETTEXT Packages.])]) 226 | fi 227 | AC_CHECK_HEADER([locale.h], 228 | AC_CHECK_FUNC([setlocale],,[ 229 | AC_MSG_ERROR([ERROR: setlocale() required! Please install setlocale packages.])])) 230 | AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE3, "$GETTEXT_PACKAGE3", [The gimp3 gettext translation domain.]) 231 | if test x"${have_gettext}" = xyes; then 232 | AC_DEFINE([HAVE_GETTEXT],1,[Enable use of local languages]) 233 | fi 234 | fi 235 | AC_SUBST(GETTEXT_PACKAGE3) 236 | 237 | case "$build_os" in 238 | cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;; 239 | esac 240 | 241 | #-------------------------------------------------------------------------- 242 | # Pass variables to fourier-config.h 243 | AC_DEFINE([FOURIER_MAJOR_VERSION],["fourier_major_version"],[gimp-plugin-fourier major version]) 244 | AC_DEFINE([FOURIER_MINOR_VERSION],["fourier_minor_version"],[gimp-plugin-fourier minor version]) 245 | 246 | #-------------------------------------------------------------------------- 247 | # Pass variables to several MAKEFILE.AM 248 | AC_SUBST([FOURIER_MAJOR_VERSION],[fourier_major_version]) 249 | AC_SUBST([FOURIER_MINOR_VERSION],[fourier_minor_version]) 250 | AC_SUBST([FOURIER_VERSION],[fourier_version]) 251 | AC_SUBST([FOURIER_PACKAGE_NAME],[fourier_package_name]) 252 | AC_SUBST([FOURIER_EMAIL],[fourier_package_email]) 253 | AC_SUBST([CPPFLAGS],["$CPPFLAGS"]) 254 | AC_SUBST([HOST],["$host"]) 255 | 256 | #-------------------------------------------------------------------------- 257 | # Put ifndef wrapper on fourier-config.h so we don't call it repeatedly. 258 | AH_TOP([#ifndef FOURIER_CONFIG_H 259 | #define FOURIER_CONFIG_H 1]) 260 | AH_BOTTOM([ 261 | 262 | #endif]) 263 | 264 | #-------------------------------------------------------------------------- 265 | AC_CONFIG_FILES([ 266 | Makefile 267 | po/Makefile 268 | rpm/gimp-fourier-plugin.spec 269 | rpm/gimp3-fourier-plugin.spec 270 | ]) 271 | AC_OUTPUT 272 | AC_MSG_NOTICE([ 273 | 274 | Configuration: 275 | 276 | Source code location ${srcdir} 277 | Build code location ${builddir} 278 | Compiler ${CC} 279 | CPPFLAGS ${CPPFLAGS} 280 | 281 | Make gimp2 fourier ${make_gimp2} 282 | fourier bindir ${GIMP2_BINDIR} 283 | GIMP2_CFLAGS ${GIMP2_CFLAGS} 284 | GIMP2_LIBS ${GIMP2_LIBS} 285 | GTK2_CFLAGS ${GTK2_CFLAGS} 286 | GTK2_LIBS ${GTK2_LIBS} 287 | 288 | Make gimp3 fourier ${make_gimp3} 289 | fourier bindir ${GIMP3_BINDIR} 290 | Use language locale ${have_gettext} 291 | fourier locale dir ${localedir} 292 | GIMP3_CFLAGS ${GIMP3_CFLAGS} 293 | GIMP3_LIBS ${GIMP3_LIBS} 294 | GTK3_CFLAGS ${GTK3_CFLAGS} 295 | GTK3_LIBS ${GTK3_LIBS} 296 | 297 | FFTW_CFLAGS ${FFTW_CFLAGS} 298 | FFTW_LIBS ${FFTW_LIBS} 299 | CFLAGS ${CFLAGS} 300 | LIBS ${LIBS} 301 | ]) 302 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 13 -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: fourier 3 | Upstream-Contact: Rémi Peyronnet 4 | Source: https://github.com/rpeyron/plugin-gimp-fourier 5 | 6 | Files: * 7 | Copyright: 2002-2022 Rémi Peyronnet 8 | License-Grant: 9 | This file is free software; 10 | you can redistribute it and/or modify it 11 | under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; 13 | either version 3, or (at your option) any later version. 14 | License: GPL-3+ 15 | -------------------------------------------------------------------------------- /debian/fourier-docs.docs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpeyron/plugin-gimp-fourier/6cdcb71609e1985b08c23de1e541fd65b2f99edd/debian/fourier-docs.docs -------------------------------------------------------------------------------- /debian/gimp2/changelog: -------------------------------------------------------------------------------- 1 | gimp-plugin-fourier (0.4.5-1) unstable; urgency=medium 2 | 3 | * Fix selection overflow 4 | 5 | -- Rémi Peyronnet Sat, 09 Mar 2024 16:49:07 +0200 6 | 7 | gimp-plugin-fourier (0.4.4-1) unstable; urgency=medium 8 | 9 | * Initial debian package 10 | 11 | -- Rémi Peyronnet Sat, 20 Aug 2022 16:49:07 +0200 12 | -------------------------------------------------------------------------------- /debian/gimp2/control: -------------------------------------------------------------------------------- 1 | Source: gimp-plugin-fourier 2 | Section: graphics 3 | Priority: optional 4 | Maintainer: Rémi Peyronnet 5 | Build-Depends: autotools-dev, libfftw3-dev, libgimp2.0-dev 6 | Standards-Version: 4.5.1 7 | Homepage: https://www.lprp.fr/gimp_plugin_en/ 8 | #Vcs-Browser: https://salsa.debian.org/debian/fourier 9 | #Vcs-Git: https://salsa.debian.org/debian/fourier.git 10 | Rules-Requires-Root: no 11 | 12 | Package: gimp-plugin-fourier 13 | Architecture: any 14 | Depends: ${shlibs:Depends}, ${misc:Depends} 15 | Description: GIMP Plugin to do forward and reverse Fourier Transform 16 | This GIMP plugin will add 2 items in the filters menu 17 | Filters/Generic/FFT Forward and Filters/Generic/FFT Inverse 18 | It does a direct and reverse Fourier Transform. 19 | It allows you to work in the frequency domain. 20 | For instance, it can be used to remove moiré patterns from images 21 | scanned from books (See README.Moire), or regular banding noise. 22 | -------------------------------------------------------------------------------- /debian/gimp3/changelog: -------------------------------------------------------------------------------- 1 | gimp3-plugin-fourier (0.4.5-1) unstable; urgency=medium 2 | 3 | * Fix selection overflow 4 | 5 | -- Rémi Peyronnet Sat, 09 Mar 2024 16:49:07 +0200 6 | 7 | gimp3-plugin-fourier (0.4.4-1) unstable; urgency=medium 8 | 9 | * Initial debian package 10 | 11 | -- Rémi Peyronnet Sat, 20 Aug 2022 16:49:07 +0200 12 | -------------------------------------------------------------------------------- /debian/gimp3/control: -------------------------------------------------------------------------------- 1 | Source: gimp3-plugin-fourier 2 | Section: graphics 3 | Priority: optional 4 | Maintainer: Rémi Peyronnet 5 | Build-Depends: autotools-dev, libfftw3-dev, libgimp-3.0-dev 6 | Standards-Version: 4.5.1 7 | Homepage: https://www.lprp.fr/gimp_plugin_en/ 8 | #Vcs-Browser: https://salsa.debian.org/debian/fourier 9 | #Vcs-Git: https://salsa.debian.org/debian/fourier.git 10 | Rules-Requires-Root: no 11 | 12 | Package: gimp3-plugin-fourier 13 | Architecture: any 14 | Depends: ${shlibs:Depends}, ${misc:Depends} 15 | Description: GIMP Plugin to do forward and reverse Fourier Transform 16 | This GIMP plugin will add 2 items in the filters menu 17 | Filters/Generic/FFT Forward and Filters/Generic/FFT Inverse 18 | It does a direct and reverse Fourier Transform. 19 | It allows you to work in the frequency domain. 20 | For instance, it can be used to remove moiré patterns from images 21 | scanned from books (See README.Moire), or regular banding noise. 22 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # See debhelper(7) (uncomment to enable) 3 | # output every command that modifies files on the build system. 4 | #export DH_VERBOSE = 1 5 | 6 | 7 | # see FEATURE AREAS in dpkg-buildflags(1) 8 | #export DEB_BUILD_MAINT_OPTIONS = hardening=+all 9 | 10 | # see ENVIRONMENT in dpkg-buildflags(1) 11 | # package maintainers to append CFLAGS 12 | #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic 13 | # package maintainers to append LDFLAGS 14 | #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed 15 | 16 | 17 | %: 18 | dh $@ 19 | 20 | 21 | # dh_make generated override targets 22 | # This is example for Cmake (See https://bugs.debian.org/641051 ) 23 | #override_dh_auto_configure: 24 | # dh_auto_configure -- \ 25 | # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) 26 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /fourier.c: -------------------------------------------------------------------------------- 1 | /** 2 | * (c) 2002-2024 - Remi Peyronnet (see README.md for contributors and changelog) 3 | * 4 | * Plugin GIMP : Fourier Transform 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see 18 | * 19 | * You'll need to install fftw version 3 20 | * 21 | * Minimal install command: 22 | * 23 | * CFLAGS="-O2" LIBS="-L/usr/local/lib -lfftw3" gimptool --install fourier.c 24 | * 25 | */ 26 | 27 | // msys2 -mingw64 -c 'echo $(gimptool-2.99 -n --build fourier.c) -lfftw3 -O3 | sh' 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | // GIMP headers 36 | #include 37 | 38 | // Uses the brillant fftw lib 39 | #include 40 | 41 | // Plugin Config 42 | #if __has_include("fourier-config.h") 43 | #include "fourier-config.h" 44 | #else 45 | #define VERSION "0.4.5" 46 | #define GETTEXT_PACKAGE3 "gimp30-fourier" 47 | #endif 48 | 49 | /** 50 | * Note about translation strings: 51 | * 52 | * * For small strings or strings used only once: 53 | * - #define MYSTRING "my string" 54 | * - use at runtime with _(MYSTRING) 55 | * 56 | * * For larger strings or used several time: 57 | * - static const char *MYSTRING = d_("my string"); // Needed for xgettex to extract the string 58 | * - use at runtime with _(MYSTRING) // To actually translate the string after gettext has been initialized 59 | * please note that both should be synchronized to extract all strings that needs to be translated, 60 | * but to avoid to extract strings that do not need to be translated 61 | * 62 | */ 63 | 64 | // To extract strings defined as static const char * (and used later with _) 65 | #define d_(String) String 66 | 67 | #if (GIMP_MAJOR_VERSION == 3) || ((GIMP_MAJOR_VERSION == 2) && (GIMP_MINOR_VERSION >= 99)) 68 | #ifdef HAVE_GETTEXT 69 | #include 70 | #include 71 | #ifdef gettext_noop 72 | # define N_(String) gettext_noop (String) 73 | #else 74 | # define N_(String) (String) 75 | #endif 76 | #define _(String) gettext (String) 77 | #else 78 | /* No i18n for now */ 79 | #define N_(x) x 80 | #define _(x) x 81 | #endif 82 | #else 83 | /* no gettext used with gimp2 version */ 84 | #define N_(x) x 85 | #define _(x) x 86 | #endif 87 | 88 | // Define location of gettext locales 89 | // - On Win32: we use default gimp locales location, in the plugin directory: 90 | // ex: %appdata%\GIMP\2.99\plug-ins\fourier\locale\fr\LC_MESSAGES\gimp30-fourier.mo 91 | // - On other platforms: we force to use the same location as GIMP application for packaging 92 | // ex: /usr/share/locale/fr/LC_MESSAGES/gimp30-fourier.mo 93 | // note: locales are not handled for user-install 94 | #ifdef _WIN32 95 | #else 96 | #define GETTEXT_FORCEDIMPLOCALEDIRECTORY 97 | #endif 98 | 99 | /** Defines ******************************************************************/ 100 | 101 | #define PLUG_IN_BINARY "fourier" 102 | #define PLUG_IN_NAME "plug_in_fft" 103 | #define PLUG_IN_VERSION "Jun 2024, " VERSION 104 | 105 | static char *PLUG_IN_AUTHOR = "Remi Peyronnet"; 106 | 107 | // Note: "known parts" should not be translated, but new parts should be (cf https://developer.gimp.org/api/3.0/libgimp/method.Procedure.add_menu_path.html) 108 | static char *PLUG_IN_MENU_LOCATION = "/Filters/Generic"; 109 | 110 | static char *PLUG_IN_PROC = "plug-in-fourier"; 111 | 112 | static char *PLUG_IN_DIR_PROC = "plug-in-fourier-forward"; 113 | static char *PLUG_IN_DIR_MENU_LABEL = d_("FFT Forward"); 114 | static char *PLUG_IN_DIR_SHORT_DESC = d_("This plug-in applies a FFT to the image, for educational or effects purpose."); 115 | static char *PLUG_IN_DIR_DESC = d_("Apply an FFT to the image. This can remove (for example) moire patterns from images scanned from books:\n\n" \ 116 | " The image should be RGB (Image|Mode|RGB)\n\n" \ 117 | " Remove the alpha layer, if present (Image|Flatten Image)\n\n" \ 118 | " Select Filters|Generic|FFT Forward\n\n" \ 119 | " Use the preselected neutral grey to effectively remove any moir patterns from the image. Either paint over any patterns or\n\n" \ 120 | " - In the Layers window, select the layer, and 'Duplicate Layer'\n" \ 121 | " - Select Colours|Brightness-Contrast. Increase the Contrast to see any patterns.\n" \ 122 | " - Use the Rectangular and/or Elliptical Selection tools to select any patterns on the contrast layer.\n" \ 123 | " - Then remove the contrast layer leaving the original FFT layer with the selections.\n" \ 124 | " - Then select Edit|Fill with FG colour, remembering to cancel the Selection afterwards!\n\n" \ 125 | " Select Filters|Generic|FFT Inverse\n\n" \ 126 | "Voila, an image without the moire pattern!"); 127 | 128 | static char *PLUG_IN_INV_PROC = "plug-in-fourier-inverse"; 129 | static char *PLUG_IN_INV_MENU_LABEL = d_("FFT Inverse"); 130 | static char *PLUG_IN_INV_DESC = d_("Apply an inverse FFT to the image, effectively restoring the original image (plus changes)."); 131 | static char *PLUG_IN_INV_SHORT_DESC = d_("This plug-in applies a FFT to the image, for educationnal or effects purpose."); 132 | 133 | 134 | /** Fourier Functions ===================================================== **/ 135 | 136 | /** Conversion functions *****************************************************/ 137 | 138 | inline gint round_gint(double value) 139 | { 140 | double floored = floor(value); 141 | if (value - floored > 0.5) 142 | { 143 | return (gint)(floored + 1); 144 | } 145 | return (gint)floored; 146 | } 147 | 148 | inline gint boost(double value) 149 | { 150 | double bounded = fabs(value / 160.0); 151 | gint boosted = round_gint(128.0 * sqrt(bounded)); 152 | boosted = (value > 0) ? boosted : -boosted; 153 | return boosted; 154 | } 155 | 156 | inline double unboost(double value) 157 | { 158 | double bounded = fabs(value / 128.0); 159 | double unboosted = 160.0 * bounded * bounded; 160 | unboosted = (value > 0) ? unboosted : -unboosted; 161 | return unboosted; 162 | } 163 | 164 | inline guchar get_guchar(gint x, gint y, double d) 165 | { 166 | gint i = round_gint(d); 167 | // if (i > 255 || i < 0) { printf(" (%d, %d: %d) ", x, y, i); } 168 | return (guchar)(i >= 255) ? 255 : ((i < 0) ? 0 : i); 169 | } 170 | 171 | inline guchar get_gchar128(gint x, gint y, gint i) 172 | { 173 | // if (i > 127 || i < -128) { printf(" (%d, %d: %d) ", x, y, i); } 174 | return (guchar)(i >= (gint)128) ? 255 : ((i <= (gint)-128) ? 0 : i + 128); 175 | } 176 | 177 | inline double get_double128(gint x, gint y, guchar c) 178 | { 179 | return (double)(c)-128.0; 180 | } 181 | 182 | /* Should pixel store imaginary part? */ 183 | static inline gint pixel_imag(gint row, gint col, gint h, gint w) 184 | { 185 | if (row == 0 && h % 2 == 0 || row == h / 2) 186 | return col > w / 2; 187 | else 188 | return row > h / 2; 189 | } 190 | 191 | /* 192 | * Map images coordinates (row, col) into Fourier array indices (row2, col2). 193 | */ 194 | static inline void map(gint row, gint col, gint h, gint w, 195 | gint *row2, gint *col2) 196 | { 197 | *row2 = (row + (h + 1) / 2) % h; /* shift origin */ 198 | *col2 = (col + (w + 1) / 2) % w; 199 | if (*col2 > w / 2) 200 | { /* wrap */ 201 | *row2 = (h - *row2) % h; 202 | *col2 = w - *col2; 203 | } 204 | *col2 *= 2; /* unit = real number */ 205 | if (pixel_imag(row, col, h, w)) 206 | (*col2)++; /* take imaginary part */ 207 | } 208 | 209 | inline double normalize(gint x, gint y, gint width, gint height) 210 | { 211 | double cx = (double)abs(x - width / 2); 212 | double cy = (double)abs(y - height / 2); 213 | double energy = (sqrt(cx) + sqrt(cy)); 214 | return energy * energy; 215 | } 216 | 217 | /** Process Functions ********************************************************/ 218 | 219 | void process_fft_forward(guchar *src_pixels, guchar *dst_pixels, gint sel_width, gint sel_height, gint src_bpp, gint dst_bpp) 220 | { 221 | 222 | gint row, col, row2, col2, cur_bpp, bounded, padding; 223 | gint progress, max_progress; 224 | fftw_plan p; 225 | double v, norm; 226 | double *fft_real; 227 | 228 | padding = (sel_width & 1) ? 1 : 2; 229 | 230 | fft_real = g_new(double, (sel_width + padding) * sel_height); 231 | 232 | progress = 0; 233 | max_progress = src_bpp * 3; 234 | 235 | p = fftw_plan_dft_r2c_2d(sel_height, sel_width, fft_real, (fftw_complex *)fft_real, FFTW_ESTIMATE); 236 | 237 | for (cur_bpp = 0; cur_bpp < src_bpp; cur_bpp++) 238 | { 239 | for (col = 0; col < sel_width; col++) 240 | { 241 | for (row = 0; row < sel_height; row++) 242 | { 243 | v = (double)src_pixels[(row * sel_width + col) * src_bpp + cur_bpp]; 244 | fft_real[row * (sel_width + padding) + col] = v; 245 | } 246 | } 247 | gimp_progress_update((double)++progress / max_progress); 248 | fftw_execute(p); 249 | gimp_progress_update((double)++progress / max_progress); 250 | 251 | for (row = 0; row < sel_height; row++) 252 | { 253 | for (col = 0; col < sel_width; col++) 254 | { 255 | map(row, col, sel_height, sel_width, &row2, &col2); 256 | v = fft_real[row2 * (sel_width + padding) + col2] / (double)(sel_width * sel_height); 257 | norm = normalize(col, row, sel_width, sel_height); 258 | bounded = boost(v * norm); 259 | dst_pixels[(row * sel_width + col) * dst_bpp + cur_bpp] = get_gchar128(col, row, bounded); 260 | } 261 | } 262 | // do not boost (0, 0), just offset it 263 | row = sel_height / 2; 264 | col = sel_width / 2; 265 | bounded = round_gint((fft_real[0] / (double)(sel_width * sel_height)) - 128.0); 266 | dst_pixels[(row * sel_width + col) * dst_bpp + cur_bpp] = get_gchar128(col, row, bounded); 267 | gimp_progress_update((double)++progress / max_progress); 268 | } 269 | 270 | fftw_destroy_plan(p); 271 | g_free(fft_real); 272 | } 273 | 274 | void process_fft_inverse(guchar *src_pixels, guchar *dst_pixels, gint sel_width, gint sel_height, gint src_bpp, gint dst_bpp) 275 | { 276 | 277 | gint row, col, row2, col2, cur_bpp, bounded, padding; 278 | gint progress, max_progress; 279 | fftw_plan p; 280 | double v, norm; 281 | double *fft_real; 282 | 283 | padding = (sel_width & 1) ? 1 : 2; 284 | 285 | fft_real = g_new(double, (sel_width + padding) * sel_height); 286 | 287 | progress = 0; 288 | max_progress = src_bpp * 3; 289 | 290 | p = fftw_plan_dft_c2r_2d(sel_height, sel_width, (fftw_complex *)fft_real, fft_real, FFTW_ESTIMATE); 291 | 292 | for (cur_bpp = 0; cur_bpp < src_bpp; cur_bpp++) 293 | { 294 | for (row = 0; row < sel_height; row++) 295 | { 296 | for (col = 0; col < sel_width; col++) 297 | { 298 | map(row, col, sel_height, sel_width, &row2, &col2); 299 | norm = normalize(col, row, sel_width, sel_height); 300 | v = get_double128(row, col, src_pixels[(row * sel_width + col) * src_bpp + cur_bpp]); 301 | fft_real[row2 * (sel_width + padding) + col2] = unboost(v) / norm; 302 | } 303 | } 304 | // restore redundancy 305 | for (col2 = 0; col2 < sel_width + padding; col2 += (sel_width + 1) / 2 * 2) 306 | { 307 | for (row2 = 1; row2 < (sel_height + 1) / 2; row2++) 308 | { 309 | fft_real[(sel_height - row2) * (sel_width + padding) + col2 + 1] = -fft_real[row2 * (sel_width + padding) + col2 + 1]; 310 | fft_real[row2 * (sel_width + padding) + col2] = fft_real[(sel_height - row2) * (sel_width + padding) + col2]; 311 | } 312 | fft_real[col2 + 1] = 0; 313 | if (sel_height % 2 == 0) 314 | fft_real[sel_height / 2 * (sel_width + padding) + col2 + 1] = 0; 315 | } 316 | // do not unboost (0, 0), just offset it 317 | row = sel_height / 2; 318 | col = sel_width / 2; 319 | v = get_double128(row, col, src_pixels[(row * sel_width + col) * src_bpp + cur_bpp]); 320 | fft_real[0] = v + 128.0; 321 | 322 | gimp_progress_update((double)++progress / max_progress); 323 | fftw_execute(p); 324 | gimp_progress_update((double)++progress / max_progress); 325 | for (col = 0; col < sel_width; col++) 326 | { 327 | for (row = 0; row < sel_height; row++) 328 | { 329 | v = fft_real[row * (sel_width + padding) + col]; 330 | dst_pixels[(row * sel_width + col) * dst_bpp + cur_bpp] = get_guchar(col, row, v); 331 | } 332 | } 333 | gimp_progress_update((double)++progress / max_progress); 334 | } 335 | 336 | fftw_destroy_plan(p); 337 | g_free(fft_real); 338 | } 339 | 340 | 341 | /** GIMP Plugin Part ====================================================== **/ 342 | 343 | #if (GIMP_MAJOR_VERSION == 3) || ((GIMP_MAJOR_VERSION == 2) && (GIMP_MINOR_VERSION >= 99)) 344 | /** GIMP 3 *******************************************************************/ 345 | 346 | // based on hot.c bundled GIMP plugin 347 | 348 | #include 349 | 350 | //#define FOURIER_USE_DIALOG false 351 | 352 | typedef struct _Fourier Fourier; 353 | typedef struct _FourierClass FourierClass; 354 | 355 | struct _Fourier 356 | { 357 | GimpPlugIn parent_instance; 358 | }; 359 | 360 | struct _FourierClass 361 | { 362 | GimpPlugInClass parent_class; 363 | }; 364 | 365 | #define FOURIER_TYPE (fourier_get_type()) 366 | #define FOURIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FOURIER_TYPE, Fourier)) 367 | 368 | #define FOURIER_DATA_DIR (gpointer) 0x01 369 | #define FOURIER_DATA_INV (gpointer) 0x02 370 | 371 | GType fourier_get_type(void) G_GNUC_CONST; 372 | 373 | static GList *fourier_query_procedures(GimpPlugIn *plug_in); 374 | static GimpProcedure *fourier_create_procedure(GimpPlugIn *plug_in, 375 | const gchar *name); 376 | gboolean fourier_set_i18n ( GimpPlugIn* plug_in, const gchar* procedure_name, 377 | gchar** gettext_domain, gchar** catalog_dir); 378 | 379 | static GimpValueArray *fourier_run(GimpProcedure *procedure, 380 | GimpRunMode run_mode, 381 | GimpImage *image, 382 | GimpDrawable **drawables, 383 | GimpProcedureConfig *config, 384 | gpointer run_data); 385 | 386 | #if FOURIER_USE_DIALOG 387 | static gboolean plugin_dialog(GimpProcedure *procedure, 388 | GObject *config); 389 | #endif 390 | 391 | G_DEFINE_TYPE(Fourier, fourier, GIMP_TYPE_PLUG_IN) 392 | 393 | GIMP_MAIN(FOURIER_TYPE) 394 | 395 | typedef enum 396 | { 397 | MODE_FORWARD, 398 | MODE_INVERSE 399 | } fourierModes; 400 | 401 | static void 402 | fourier_class_init(FourierClass *klass) 403 | { 404 | GimpPlugInClass *plug_in_class = GIMP_PLUG_IN_CLASS(klass); 405 | 406 | plug_in_class->query_procedures = fourier_query_procedures; 407 | plug_in_class->create_procedure = fourier_create_procedure; 408 | plug_in_class->set_i18n = fourier_set_i18n; 409 | } 410 | 411 | static void 412 | fourier_init(Fourier *fourier) 413 | { 414 | } 415 | 416 | // Override standard i18n to specialize 417 | gboolean fourier_set_i18n ( 418 | GimpPlugIn* plug_in, 419 | const gchar* procedure_name, 420 | gchar** gettext_domain, 421 | gchar** catalog_dir 422 | ) 423 | { 424 | *gettext_domain = g_strdup(GETTEXT_PACKAGE3); 425 | #ifdef GETTEXT_FORCEDIMPLOCALEDIRECTORY 426 | *catalog_dir = g_strdup(gimp_locale_directory()); 427 | #endif 428 | return TRUE; 429 | } 430 | 431 | /* 432 | // This was the previous code before using set_i18n function, to be included in query & run 433 | #ifdef HAVE_GETTEXT 434 | setlocale (LC_ALL, ""); 435 | bindtextdomain (GETTEXT_PACKAGE3, gimp_locale_directory ()); 436 | #ifdef HAVE_BIND_TEXTDOMAIN_CODESET 437 | bind_textdomain_codeset (GETTEXT_PACKAGE3, "UTF-8"); 438 | #endif 439 | textdomain (GETTEXT_PACKAGE3); 440 | #endif 441 | */ 442 | 443 | static GList * 444 | fourier_query_procedures(GimpPlugIn *plug_in) 445 | { 446 | #if FOURIER_USE_DIALOG 447 | // If using dialog, we define only one procedure 448 | return g_list_append(NULL, g_strdup(PLUG_IN_PROC)); 449 | #else 450 | // If not using dialog, we define all procedures 451 | return g_list_append( 452 | g_list_append(NULL, g_strdup(PLUG_IN_DIR_PROC)), 453 | g_strdup(PLUG_IN_INV_PROC) 454 | ); 455 | #endif 456 | } 457 | 458 | static GimpProcedure * 459 | fourier_create_procedure(GimpPlugIn *plug_in, 460 | const gchar *name) 461 | { 462 | GimpProcedure *procedure = NULL; 463 | 464 | 465 | 466 | #if FOURIER_USE_DIALOG 467 | if (!strcmp(name, PLUG_IN_PROC)) 468 | { 469 | // One for all procedure with dialog 470 | procedure = gimp_image_procedure_new(plug_in, name, 471 | GIMP_PDB_PROC_TYPE_PLUGIN, 472 | fourier_run, NULL, NULL); 473 | 474 | gimp_procedure_set_image_types(procedure, "RGB"); 475 | gimp_procedure_set_sensitivity_mask(procedure, 476 | GIMP_PROCEDURE_SENSITIVE_DRAWABLE); 477 | 478 | gimp_procedure_set_menu_label(procedure, _("_Fourier...")); 479 | gimp_procedure_add_menu_path(procedure, PLUG_IN_MENU_LOCATION); 480 | 481 | gimp_procedure_set_documentation(procedure, 482 | /* menu entry short one-liner */ _(PLUG_IN_DIR_SHORT_DESC), 483 | /* detailed help description */ _(PLUG_IN_DIR_DESC), 484 | name); 485 | gimp_procedure_set_attribution(procedure, 486 | /* GIMP3 plugin author(s) */ PLUG_IN_AUTHOR, 487 | /* plugin copyright license */ "GPL3+", 488 | /* date(s) created/made */ PLUG_IN_VERSION); 489 | 490 | gimp_procedure_add_int_argument(procedure, "mode", 491 | _("Mode"), 492 | _("Mode { Foward (0), Inversed (1) }"), 493 | 0, 1, MODE_FORWARD, 494 | G_PARAM_READWRITE); 495 | 496 | gimp_procedure_add_boolean_argument(procedure, "new-layer", 497 | _("Create _new layer"), 498 | _("Create a new layer"), 499 | TRUE, 500 | G_PARAM_READWRITE); 501 | } 502 | #endif 503 | 504 | if (!strcmp(name, PLUG_IN_DIR_PROC)) 505 | { 506 | // Forward without dialog 507 | procedure = gimp_image_procedure_new(plug_in, name, 508 | GIMP_PDB_PROC_TYPE_PLUGIN, 509 | fourier_run, FOURIER_DATA_DIR, NULL); 510 | 511 | gimp_procedure_set_image_types(procedure, "RGB"); 512 | gimp_procedure_set_sensitivity_mask(procedure, 513 | GIMP_PROCEDURE_SENSITIVE_DRAWABLE); 514 | 515 | gimp_procedure_set_menu_label(procedure, _(PLUG_IN_DIR_MENU_LABEL)); 516 | gimp_procedure_add_menu_path(procedure, PLUG_IN_MENU_LOCATION); 517 | 518 | gimp_procedure_set_documentation(procedure, 519 | _(PLUG_IN_DIR_SHORT_DESC), 520 | _(PLUG_IN_DIR_DESC), 521 | name); 522 | gimp_procedure_set_attribution(procedure, 523 | PLUG_IN_AUTHOR, 524 | "GPL3+", 525 | PLUG_IN_VERSION); 526 | } 527 | else if (!strcmp(name, PLUG_IN_INV_PROC)) 528 | { 529 | // Inverse without dialog 530 | procedure = gimp_image_procedure_new(plug_in, name, 531 | GIMP_PDB_PROC_TYPE_PLUGIN, 532 | fourier_run, FOURIER_DATA_INV, NULL); 533 | 534 | gimp_procedure_set_image_types(procedure, "RGB"); 535 | gimp_procedure_set_sensitivity_mask(procedure, 536 | GIMP_PROCEDURE_SENSITIVE_DRAWABLE); 537 | 538 | gimp_procedure_set_menu_label(procedure, _(PLUG_IN_INV_MENU_LABEL)); 539 | gimp_procedure_add_menu_path(procedure, PLUG_IN_MENU_LOCATION); 540 | 541 | gimp_procedure_set_documentation(procedure, 542 | _(PLUG_IN_INV_SHORT_DESC), 543 | _(PLUG_IN_INV_DESC), 544 | name); 545 | gimp_procedure_set_attribution(procedure, 546 | PLUG_IN_AUTHOR, 547 | "GPL3+", 548 | PLUG_IN_VERSION); 549 | 550 | } 551 | 552 | return procedure; 553 | } 554 | 555 | 556 | static gboolean 557 | fourier_core(GimpDrawable *drawable, gboolean inverse /*, gboolean new_layer*/) 558 | { 559 | gint action; 560 | GeglBuffer *src_buffer; 561 | GeglBuffer *dest_buffer; 562 | const Babl *src_format; 563 | const Babl *dest_format; 564 | gint src_bpp; 565 | gint dest_bpp; 566 | gboolean success = TRUE; 567 | //GimpLayer *nl = NULL; 568 | gint width, height; 569 | gint sel_x1, sel_x2, sel_y1, sel_y2; 570 | guchar *src, *dst; 571 | 572 | width = gimp_drawable_get_width(drawable); 573 | height = gimp_drawable_get_height(drawable); 574 | 575 | if (gimp_drawable_has_alpha(drawable)) 576 | src_format = babl_format("R'G'B'A u8"); 577 | else 578 | src_format = babl_format("R'G'B' u8"); 579 | 580 | dest_format = src_format; 581 | 582 | /* 583 | if (new_layer) 584 | { 585 | gchar name[40]; 586 | const gchar *mode_names[] = 587 | { 588 | "forward", 589 | "inversed", 590 | }; 591 | 592 | g_snprintf(name, sizeof(name), "fourier mask (%s)", mode_names[(inverse)?1:0]); 593 | 594 | nl = gimp_layer_new(image, name, width, height, 595 | GIMP_RGBA_IMAGE, 596 | 100, 597 | gimp_image_get_default_new_layer_mode(image)); 598 | 599 | gimp_drawable_fill(GIMP_DRAWABLE(nl), GIMP_FILL_TRANSPARENT); 600 | gimp_image_insert_layer(image, nl, NULL, 0); 601 | 602 | dest_format = babl_format("R'G'B'A u8"); 603 | } 604 | */ 605 | 606 | if (!gimp_drawable_mask_intersect(drawable, 607 | &sel_x1, &sel_y1, &width, &height)) 608 | return success; 609 | 610 | src_bpp = babl_format_get_bytes_per_pixel(src_format); 611 | dest_bpp = babl_format_get_bytes_per_pixel(dest_format); 612 | 613 | sel_x2 = sel_x1 + width; 614 | sel_y2 = sel_y1 + height; 615 | 616 | src = g_new(guchar, width * height * src_bpp); 617 | dst = g_new(guchar, width * height * dest_bpp); 618 | 619 | src_buffer = gimp_drawable_get_buffer(drawable); 620 | 621 | /*if (new_layer) 622 | { 623 | dest_buffer = gimp_drawable_get_buffer(GIMP_DRAWABLE(nl)); 624 | } 625 | else 626 | {*/ 627 | dest_buffer = gimp_drawable_get_shadow_buffer(drawable); 628 | /*}*/ 629 | 630 | gegl_buffer_get(src_buffer, 631 | GEGL_RECTANGLE(sel_x1, sel_y1, width, height), 1.0, 632 | src_format, src, 633 | GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE); 634 | 635 | gimp_progress_init(inverse ? _("Applying inverse Fourier transform...") : _("Applying forward Fourier transform...")); 636 | 637 | if (!inverse) 638 | { // Forward 639 | process_fft_forward(src, dst, width, height, src_bpp, dest_bpp); 640 | } 641 | else 642 | { // Inverse 643 | process_fft_inverse(src, dst, width, height, src_bpp, dest_bpp); 644 | } 645 | 646 | gegl_buffer_set(dest_buffer, 647 | GEGL_RECTANGLE(sel_x1, sel_y1, width, height), 0, 648 | dest_format, dst, 649 | GEGL_AUTO_ROWSTRIDE); 650 | 651 | gimp_progress_update(1.0); 652 | 653 | g_free(src); 654 | g_free(dst); 655 | 656 | g_object_unref(src_buffer); 657 | g_object_unref(dest_buffer); 658 | 659 | /*if (new_layer) 660 | { 661 | gimp_drawable_update(GIMP_DRAWABLE(nl), sel_x1, sel_y1, width, height); 662 | } 663 | else 664 | {*/ 665 | gimp_drawable_merge_shadow(drawable, TRUE); 666 | gimp_drawable_update(drawable, sel_x1, sel_y1, width, height); 667 | /*}*/ 668 | 669 | gimp_displays_flush(); 670 | 671 | return success; 672 | } 673 | 674 | static GimpValueArray * 675 | fourier_run(GimpProcedure *procedure, 676 | GimpRunMode run_mode, 677 | GimpImage *image, 678 | GimpDrawable **drawables, 679 | GimpProcedureConfig *config, 680 | gpointer run_data) 681 | { 682 | GimpDrawable *drawable; 683 | gboolean inverse = FALSE; 684 | gboolean new_layer = FALSE; 685 | 686 | gegl_init(NULL, NULL); 687 | 688 | if (gimp_core_object_array_get_length ((GObject **) drawables) != 1) 689 | { 690 | GError *error = NULL; 691 | 692 | g_set_error(&error, GIMP_PLUG_IN_ERROR, 0, 693 | _("Procedure '%s' only works with one drawable."), 694 | gimp_procedure_get_name(procedure)); 695 | 696 | return gimp_procedure_new_return_values(procedure, 697 | GIMP_PDB_CALLING_ERROR, 698 | error); 699 | } 700 | else 701 | { 702 | drawable = drawables[0]; 703 | } 704 | 705 | #if FOURIER_USE_DIALOG 706 | if (run_mode == GIMP_RUN_INTERACTIVE && !plugin_dialog(procedure, G_OBJECT(config))) 707 | return gimp_procedure_new_return_values(procedure, 708 | GIMP_PDB_CANCEL, 709 | NULL); 710 | 711 | /*g_object_get(config, 712 | "mode", &mode, 713 | "new-layer", &new_layer, 714 | NULL);*/ 715 | #else 716 | inverse = run_data == FOURIER_DATA_INV; 717 | new_layer = FALSE; 718 | #endif 719 | 720 | if (!fourier_core(drawable, inverse /*, new_layer*/)) 721 | return gimp_procedure_new_return_values(procedure, 722 | GIMP_PDB_EXECUTION_ERROR, 723 | NULL); 724 | 725 | if (run_mode != GIMP_RUN_NONINTERACTIVE) 726 | gimp_displays_flush(); 727 | 728 | return gimp_procedure_new_return_values(procedure, GIMP_PDB_SUCCESS, NULL); 729 | } 730 | 731 | #if FOURIER_USE_DIALOG 732 | 733 | static gboolean 734 | plugin_dialog(GimpProcedure *procedure, 735 | GObject *config) 736 | { 737 | GtkWidget *dlg; 738 | GtkWidget *vbox; 739 | GtkWidget *hbox; 740 | GtkListStore *store; 741 | gboolean run; 742 | 743 | gimp_ui_init(PLUG_IN_BINARY); 744 | 745 | dlg = gimp_procedure_dialog_new(procedure, 746 | GIMP_PROCEDURE_CONFIG(config), 747 | _("Fourier")); 748 | 749 | gimp_dialog_set_alternative_button_order(GTK_DIALOG(dlg), 750 | GTK_RESPONSE_OK, 751 | GTK_RESPONSE_CANCEL, 752 | -1); 753 | 754 | gimp_window_set_transient(GTK_WINDOW(dlg)); 755 | 756 | store = gimp_int_store_new(_("_Forward"), MODE_FORWARD, 757 | _("_Inverse"), MODE_INVERSE, 758 | NULL); 759 | gimp_procedure_dialog_get_int_radio(GIMP_PROCEDURE_DIALOG(dlg), 760 | "mode", GIMP_INT_STORE(store)); 761 | 762 | vbox = gimp_procedure_dialog_fill_box(GIMP_PROCEDURE_DIALOG(dlg), 763 | "fourier-left-side", 764 | "mode", 765 | "new-layer", 766 | NULL); 767 | gtk_box_set_spacing(GTK_BOX(vbox), 12); 768 | 769 | hbox = gimp_procedure_dialog_fill_box(GIMP_PROCEDURE_DIALOG(dlg), 770 | "fourier-hbox", 771 | "fourier-left-side", 772 | "action", 773 | NULL); 774 | gtk_box_set_spacing(GTK_BOX(hbox), 12); 775 | gtk_box_set_homogeneous(GTK_BOX(hbox), TRUE); 776 | gtk_widget_set_margin_bottom(hbox, 12); 777 | gtk_orientable_set_orientation(GTK_ORIENTABLE(hbox), 778 | GTK_ORIENTATION_HORIZONTAL); 779 | 780 | gimp_procedure_dialog_fill(GIMP_PROCEDURE_DIALOG(dlg), 781 | "fourier-hbox", 782 | NULL); 783 | 784 | gtk_widget_show(dlg); 785 | 786 | run = gimp_procedure_dialog_run(GIMP_PROCEDURE_DIALOG(dlg)); 787 | 788 | gtk_widget_destroy(dlg); 789 | 790 | return run; 791 | } 792 | 793 | #endif 794 | 795 | #elif GIMP_MAJOR_VERSION == 2 796 | /** GIMP 2 *******************************************************************/ 797 | 798 | 799 | static void query(void); 800 | static void run(const gchar *name, 801 | gint nparams, 802 | const GimpParam *param, 803 | gint *nreturn_vals, 804 | GimpParam **return_vals); 805 | 806 | GimpPlugInInfo PLUG_IN_INFO = { 807 | NULL, /* init_proc */ 808 | NULL, /* quit_proc */ 809 | query, /* query_proc */ 810 | run /* run_proc */ 811 | }; 812 | 813 | 814 | 815 | MAIN() 816 | 817 | void query(void) 818 | { 819 | /* Definition of parameters */ 820 | static GimpParamDef args[] = { 821 | {GIMP_PDB_INT32, (gchar *)"run_mode", (gchar *)"Interactive, non-interactive"}, 822 | {GIMP_PDB_IMAGE, (gchar *)"image", (gchar *)"Input image (unused)"}, 823 | {GIMP_PDB_DRAWABLE, (gchar *)"drawable", (gchar *)"Input drawable"}}; 824 | 825 | /* Forward FFT */ 826 | gimp_install_procedure( 827 | PLUG_IN_DIR_PROC, 828 | PLUG_IN_DIR_DESC, 829 | PLUG_IN_DIR_SHORT_DESC, 830 | PLUG_IN_AUTHOR, 831 | PLUG_IN_AUTHOR, 832 | PLUG_IN_VERSION, 833 | PLUG_IN_DIR_MENU_LABEL, 834 | "RGB*, GRAY*", 835 | GIMP_PLUGIN, 836 | G_N_ELEMENTS(args), 0, 837 | args, NULL); 838 | gimp_plugin_menu_register(PLUG_IN_DIR_PROC, PLUG_IN_MENU_LOCATION); 839 | 840 | /* Inverse FFT */ 841 | gimp_install_procedure( 842 | PLUG_IN_INV_PROC, 843 | PLUG_IN_INV_DESC, 844 | PLUG_IN_INV_SHORT_DESC, 845 | PLUG_IN_AUTHOR, 846 | PLUG_IN_AUTHOR, 847 | PLUG_IN_VERSION, 848 | PLUG_IN_INV_MENU_LABEL, 849 | "RGB*, GRAY*", 850 | GIMP_PLUGIN, 851 | G_N_ELEMENTS(args), 0, 852 | args, NULL); 853 | gimp_plugin_menu_register(PLUG_IN_INV_PROC, PLUG_IN_MENU_LOCATION); 854 | } 855 | 856 | static void 857 | run(const gchar *name, 858 | gint nparams, 859 | const GimpParam *param, 860 | gint *nreturn_vals, 861 | GimpParam **return_vals) 862 | { 863 | /* Return values */ 864 | static GimpParam values[1]; 865 | 866 | gint sel_x1, sel_y1, sel_x2, sel_y2, sel_width, sel_height, padding; 867 | gint img_height, img_width, img_bpp, img_has_alpha; 868 | 869 | gint32 drawable_id; 870 | GimpDrawable *drawable; 871 | GimpRunMode run_mode; 872 | GimpPDBStatusType status; 873 | const Babl *format; 874 | 875 | GeglBuffer *buffer; 876 | GeglRectangle *roi; 877 | guchar *img_pixels; 878 | 879 | int fft_inv = 0; 880 | 881 | if (strcmp(name, PLUG_IN_INV_PROC) == 0) 882 | { 883 | fft_inv = 1; 884 | } 885 | 886 | *nreturn_vals = 1; 887 | *return_vals = values; 888 | 889 | status = GIMP_PDB_SUCCESS; 890 | 891 | if (param[0].type != GIMP_PDB_INT32) 892 | status = GIMP_PDB_CALLING_ERROR; 893 | if (param[2].type != GIMP_PDB_DRAWABLE) 894 | status = GIMP_PDB_CALLING_ERROR; 895 | 896 | run_mode = (GimpRunMode)param[0].data.d_int32; 897 | 898 | gegl_init (NULL, NULL); 899 | 900 | drawable_id = param[2].data.d_drawable; 901 | 902 | img_width = gimp_drawable_width(drawable_id); 903 | img_height = gimp_drawable_height(drawable_id); 904 | // img_bpp = gimp_drawable_get_bpp(drawable_id); 905 | img_has_alpha = gimp_drawable_has_alpha(drawable_id); 906 | 907 | if (gimp_drawable_has_alpha(drawable_id)) // gimp_drawable_is_rgb (drawable) 908 | format = babl_format("R'G'B'A u8"); 909 | else 910 | format = babl_format("R'G'B' u8"); 911 | 912 | img_bpp = babl_format_get_bytes_per_pixel(format); 913 | 914 | gimp_drawable_mask_bounds(drawable_id, &sel_x1, &sel_y1, &sel_x2, &sel_y2); 915 | 916 | // Ensure selection does not exceed image 917 | if (sel_x1 < 0) sel_x1 = 0; if (sel_x1 > img_width) sel_x1 = img_width; 918 | if (sel_y1 < 0) sel_y1 = 0; if (sel_y1 > img_height) sel_y1 = img_height; 919 | if (sel_x2 < 0) sel_x2 = 0; if (sel_x2 > img_width) sel_x2 = img_width; 920 | if (sel_y2 < 0) sel_y2 = 0; if (sel_y2 > img_height) sel_y2 = img_height; 921 | 922 | sel_width = sel_x2 - sel_x1; 923 | sel_height = sel_y2 - sel_y1; 924 | 925 | //printf("Image size %dx%d - %d bpp\n", img_width, img_height, img_bpp); 926 | //printf("Selection size %dx%d (%d,%d-%d,%d)\n", sel_width, sel_height, sel_x1, sel_y1, sel_x2, sel_y2); 927 | 928 | if (status == GIMP_PDB_SUCCESS) 929 | { 930 | gimp_progress_init(fft_inv ? _("Applying inverse Fourier transform...") : _("Applying forward Fourier transform...")); 931 | 932 | // Init buffers 933 | GeglBuffer *src_buffer = gimp_drawable_get_buffer(drawable_id); 934 | GeglBuffer *dest_buffer = gimp_drawable_get_shadow_buffer(drawable_id); 935 | 936 | roi = GEGL_RECTANGLE(sel_x1, sel_y1, sel_width, sel_height); 937 | img_pixels = g_malloc(roi->width * roi->height * img_bpp); 938 | 939 | // Get source image 940 | gegl_buffer_get(src_buffer, roi, 1.0, format, img_pixels, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE); 941 | 942 | if (fft_inv == 0) 943 | { 944 | process_fft_forward(img_pixels, img_pixels, sel_width, sel_height, img_bpp, img_bpp); 945 | } 946 | else 947 | { 948 | process_fft_inverse(img_pixels, img_pixels, sel_width, sel_height, img_bpp, img_bpp); 949 | } 950 | 951 | // Set result to image 952 | gegl_buffer_set(dest_buffer, GEGL_RECTANGLE(sel_x1, sel_y1, sel_x2, sel_y2), 0, 953 | format, img_pixels, 954 | GEGL_AUTO_ROWSTRIDE); 955 | 956 | g_free(img_pixels); 957 | g_object_unref(src_buffer); 958 | g_object_unref(dest_buffer); 959 | 960 | gimp_drawable_merge_shadow(drawable_id, TRUE); 961 | gimp_drawable_update(drawable_id, sel_x1, sel_y1, (sel_x2 - sel_x1), (sel_y2 - sel_y1)); 962 | gimp_displays_flush(); 963 | 964 | // set FG to neutral grey; used to mask moire patterns, etc 965 | if (fft_inv == 0) 966 | { 967 | GimpRGB neutral_grey; 968 | gimp_rgba_set_uchar(&neutral_grey, 128, 128, 128, 1); 969 | gimp_context_set_foreground(&neutral_grey); 970 | } 971 | 972 | gimp_progress_init(fft_inv ? _("Inverse Fourier transform applied successfully.") : _("Forward Fourier transform applied successfully.")); 973 | 974 | values[0].type = GIMP_PDB_STATUS; 975 | values[0].data.d_status = status; 976 | } 977 | } 978 | 979 | #else 980 | #error "Unsupported GIMP version" 981 | #endif 982 | 983 | -------------------------------------------------------------------------------- /po/Makefile.am: -------------------------------------------------------------------------------- 1 | LANGUAGES = fr pt 2 | PO_FILES = fr.po pt.po 3 | 4 | # This information is here to help translators create/update (pot/po files): 5 | # 6 | # To create a new pot file, you need to cd into this po directory first: 7 | # cd po 8 | # del gimp30-fourier.pot 9 | # make update-pot 10 | # 11 | # To update existing po files you need to cd into po directory and then do: 12 | # cd po 13 | # make update-po 14 | # 15 | 16 | .PHONY: all install uninstall clean $(LANGUAGES) 17 | .PHONY: update-po update-pot 18 | 19 | all: update-pot $(LANGUAGES) 20 | 21 | $(LANGUAGES): 22 | if [[ -e $(srcdir)/$@.po ]]; \ 23 | then $(MSGFMT) -c -v -o $(builddir)/$@.mo $(srcdir)/$@.po; \ 24 | else $(MSGFMT) -c -v -o $(builddir)/$@.mo $(builddir)/$@.po; \ 25 | fi 26 | 27 | update-po: $(PO_FILES) 28 | 29 | $(PO_FILES): $(GETTEXT_PACKAGE3).pot 30 | if [[ -e $(srcdir)/$@ ]]; \ 31 | then $(MSGMERGE) -U $(srcdir)/$@ $^; \ 32 | else $(MSGFMT) -l $(subst .po,,$@) -o $(builddir)/$@ -i $^; \ 33 | fi 34 | 35 | install-data-local: $(LANGUAGES) 36 | for L in $(LANGUAGES); \ 37 | do $(MKDIR_P) -p "$(DESTDIR)$(localedir)/$$L/LC_MESSAGES"; \ 38 | install -v -m 0644 $(builddir)/$$L.mo "$(DESTDIR)$(localedir)/$$L/LC_MESSAGES/$(GETTEXT_PACKAGE3).mo"; \ 39 | done 40 | 41 | uninstall-local: $(LANGUAGES) 42 | for L in $(LANGUAGES); \ 43 | do rm -vf "$(DESTDIR)$(localedir)/$$L/LC_MESSAGES/$(GETTEXT_PACKAGE3).mo"; \ 44 | done 45 | 46 | clean-local: 47 | rm -f *.po~ *.mo *.mo~ 48 | 49 | update-pot: $(GETTEXT_PACKAGE3).pot 50 | 51 | $(GETTEXT_PACKAGE3).pot: 52 | $(XGETTEXT) -k_ -k_\" -kd_ -d $(GETTEXT_PACKAGE3) -o $@ \ 53 | --package-version=$(FOURIER_VERSION) --msgid-bugs-address=$(FOURIER_EMAIL) \ 54 | ../*.c 55 | 56 | EXTRA_DIST = $(PO_FILES) $(GETTEXT_PACKAGE3).pot 57 | -------------------------------------------------------------------------------- /po/fr.po: -------------------------------------------------------------------------------- 1 | # gimp3-fourier-plugin 2 | # Copyright (C) 2024 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # Remi Peyronnet, 2024. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gimp30-fourier-plugin\n" 9 | "Report-Msgid-Bugs-To: https://github.com/rpeyron/plugin-gimp-fourier/issues\n" 10 | "POT-Creation-Date: 2024-10-08 19:46+0200\n" 11 | "PO-Revision-Date: 2024-10-08 19:59+0200\n" 12 | "Last-Translator: \n" 13 | "Language-Team: \n" 14 | "Language: fr\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "X-Generator: Poedit 3.1.1\n" 19 | 20 | #: ../fourier.c:101 21 | msgid "FFT Forward" 22 | msgstr "FFT _Directe" 23 | 24 | #: ../fourier.c:102 25 | msgid "" 26 | "This plug-in applies a FFT to the image, for educational or effects purpose." 27 | msgstr "" 28 | "Ce plugin permet d'appliquer une transformation de fourier (FFT) à l'image, " 29 | "à des fins pédagogiques ou artistiques." 30 | 31 | #: ../fourier.c:103 32 | msgid "" 33 | "Apply an FFT to the image. This can remove (for example) moire patterns from " 34 | "images scanned from books:\n" 35 | "\n" 36 | " The image should be RGB (Image|Mode|RGB)\n" 37 | "\n" 38 | " Remove the alpha layer, if present (Image|Flatten Image)\n" 39 | "\n" 40 | " Select Filters|Generic|FFT Forward\n" 41 | "\n" 42 | " Use the preselected neutral grey to effectively remove any moir patterns " 43 | "from the image. Either paint over any patterns or\n" 44 | "\n" 45 | " - In the Layers window, select the layer, and 'Duplicate Layer'\n" 46 | " - Select Colours|Brightness-Contrast. Increase the Contrast to see any " 47 | "patterns.\n" 48 | " - Use the Rectangular and/or Elliptical Selection tools to select any " 49 | "patterns on the contrast layer.\n" 50 | " - Then remove the contrast layer leaving the original FFT layer with " 51 | "the selections.\n" 52 | " - Then select Edit|Fill with FG colour, remembering to cancel the " 53 | "Selection afterwards!\n" 54 | "\n" 55 | " Select Filters|Generic|FFT Inverse\n" 56 | "\n" 57 | "Voila, an image without the moire pattern!" 58 | msgstr "" 59 | "Applique une transformation de fourier (FFT) à l'image. Cela peut, par " 60 | "exemple, supprimer les motifs de moiré des images scannées à partir de " 61 | "livres :\n" 62 | "\n" 63 | " L'image doit être en RVB (Image | Mode | RVB).\n" 64 | "\n" 65 | " Supprimer la couche alpha si elle est présente (Image | Aplatir " 66 | "l'image).\n" 67 | "\n" 68 | " Sélectionner Filtres | Générique | FFT Directe.\n" 69 | "\n" 70 | " Utiliser le gris neutre présélectionné pour supprimer efficacement les " 71 | "motifs de moiré de l'image. Soit peindre sur les motifs, soit :\n" 72 | "\n" 73 | " Dans la fenêtre des calques, sélectionner le calque et « Dupliquer le " 74 | "calque ».\n" 75 | " - Sélectionner Couleurs | Luminosité-Contraste. Augmenter le contraste " 76 | "pour voir les motifs.\n" 77 | " - Utiliser les outils de sélection rectangulaire et/ou elliptique pour " 78 | "sélectionner les motifs sur le calque de contraste.\n" 79 | " - Ensuite, supprimer le calque de contraste en laissant le calque FFT " 80 | "d'origine avec les sélections.\n" 81 | " - Puis, sélectionner Édition | Remplir avec la couleur de premier plan, " 82 | "en pensant à annuler la sélection après !\n" 83 | "\n" 84 | " Sélectionner Filtres | Générique | FFT Inverse.\n" 85 | "\n" 86 | "Et voilà, une image sans motif de moiré !" 87 | 88 | #: ../fourier.c:117 89 | msgid "FFT Inverse" 90 | msgstr "FFT _Inverse" 91 | 92 | #: ../fourier.c:118 93 | msgid "" 94 | "Apply an inverse FFT to the image, effectively restoring the original image " 95 | "(plus changes)." 96 | msgstr "" 97 | "Applique une transformation de fourier inverse à l'image, permettant ainsi " 98 | "de retrouver l'image avant transformation de fourier direct (avec " 99 | "modifications)." 100 | 101 | #: ../fourier.c:119 102 | msgid "" 103 | "This plug-in applies a FFT to the image, for educationnal or effects purpose." 104 | msgstr "" 105 | "Ce plugin permet d'appliquer une transformation de fourier (FFT) à l'image, " 106 | "à des fins pédagogiques ou artistiques." 107 | 108 | #: ../fourier.c:448 109 | msgid "_Fourier..." 110 | msgstr "_Fourier..." 111 | 112 | #: ../fourier.c:461 113 | msgid "Mode" 114 | msgstr "Mode" 115 | 116 | #: ../fourier.c:462 117 | msgid "Mode { Foward (0), Inversed (1) }" 118 | msgstr "Mode { Directe (0), Inverse (1) }" 119 | 120 | #: ../fourier.c:467 121 | msgid "Create _new layer" 122 | msgstr "Créer un _nouveau calque" 123 | 124 | #: ../fourier.c:468 125 | msgid "Create a new layer" 126 | msgstr "Créer un nouveau calque" 127 | 128 | #: ../fourier.c:616 ../fourier.c:923 129 | msgid "Applying inverse Fourier transform..." 130 | msgstr "Transformation de Fourier inverse en cours..." 131 | 132 | #: ../fourier.c:616 ../fourier.c:923 133 | msgid "Applying forward Fourier transform..." 134 | msgstr "Transformation de Fourier directe en cours..." 135 | 136 | #: ../fourier.c:686 137 | #, c-format 138 | msgid "Procedure '%s' only works with one drawable." 139 | msgstr "La fonction '%s' fonctionne seulement avec une seule image." 140 | 141 | #: ../fourier.c:740 142 | msgid "Fourier" 143 | msgstr "Fourier" 144 | 145 | #: ../fourier.c:749 146 | msgid "_Forward" 147 | msgstr "_Directe" 148 | 149 | #: ../fourier.c:750 150 | msgid "_Inverse" 151 | msgstr "_Inverse" 152 | 153 | #: ../fourier.c:965 154 | msgid "Inverse Fourier transform applied successfully." 155 | msgstr "Transformation de Fourier inverse appliquée avec succès." 156 | 157 | #: ../fourier.c:965 158 | msgid "Forward Fourier transform applied successfully." 159 | msgstr "Transformation de Fourier directe appliquée avec succès." 160 | -------------------------------------------------------------------------------- /po/gimp30-fourier.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: PACKAGE VERSION\n" 10 | "Report-Msgid-Bugs-To: https://github.com/rpeyron/plugin-gimp-fourier/issues\n" 11 | "POT-Creation-Date: 2024-10-09 00:28+0200\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: ../fourier.c:111 21 | msgid "FFT Forward" 22 | msgstr "" 23 | 24 | #: ../fourier.c:112 25 | msgid "" 26 | "This plug-in applies a FFT to the image, for educational or effects purpose." 27 | msgstr "" 28 | 29 | #: ../fourier.c:113 30 | msgid "" 31 | "Apply an FFT to the image. This can remove (for example) moire patterns from " 32 | "images scanned from books:\n" 33 | "\n" 34 | " The image should be RGB (Image|Mode|RGB)\n" 35 | "\n" 36 | " Remove the alpha layer, if present (Image|Flatten Image)\n" 37 | "\n" 38 | " Select Filters|Generic|FFT Forward\n" 39 | "\n" 40 | " Use the preselected neutral grey to effectively remove any moir patterns " 41 | "from the image. Either paint over any patterns or\n" 42 | "\n" 43 | " - In the Layers window, select the layer, and 'Duplicate Layer'\n" 44 | " - Select Colours|Brightness-Contrast. Increase the Contrast to see any " 45 | "patterns.\n" 46 | " - Use the Rectangular and/or Elliptical Selection tools to select any " 47 | "patterns on the contrast layer.\n" 48 | " - Then remove the contrast layer leaving the original FFT layer with " 49 | "the selections.\n" 50 | " - Then select Edit|Fill with FG colour, remembering to cancel the " 51 | "Selection afterwards!\n" 52 | "\n" 53 | " Select Filters|Generic|FFT Inverse\n" 54 | "\n" 55 | "Voila, an image without the moire pattern!" 56 | msgstr "" 57 | 58 | #: ../fourier.c:127 59 | msgid "FFT Inverse" 60 | msgstr "" 61 | 62 | #: ../fourier.c:128 63 | msgid "" 64 | "Apply an inverse FFT to the image, effectively restoring the original image " 65 | "(plus changes)." 66 | msgstr "" 67 | 68 | #: ../fourier.c:129 69 | msgid "" 70 | "This plug-in applies a FFT to the image, for educationnal or effects purpose." 71 | msgstr "" 72 | 73 | #: ../fourier.c:477 74 | msgid "_Fourier..." 75 | msgstr "" 76 | 77 | #: ../fourier.c:490 78 | msgid "Mode" 79 | msgstr "" 80 | 81 | #: ../fourier.c:491 82 | msgid "Mode { Foward (0), Inversed (1) }" 83 | msgstr "" 84 | 85 | #: ../fourier.c:496 86 | msgid "Create _new layer" 87 | msgstr "" 88 | 89 | #: ../fourier.c:497 90 | msgid "Create a new layer" 91 | msgstr "" 92 | 93 | #: ../fourier.c:634 ../fourier.c:930 94 | msgid "Applying inverse Fourier transform..." 95 | msgstr "" 96 | 97 | #: ../fourier.c:634 ../fourier.c:930 98 | msgid "Applying forward Fourier transform..." 99 | msgstr "" 100 | 101 | #: ../fourier.c:693 102 | #, c-format 103 | msgid "Procedure '%s' only works with one drawable." 104 | msgstr "" 105 | 106 | #: ../fourier.c:747 107 | msgid "Fourier" 108 | msgstr "" 109 | 110 | #: ../fourier.c:756 111 | msgid "_Forward" 112 | msgstr "" 113 | 114 | #: ../fourier.c:757 115 | msgid "_Inverse" 116 | msgstr "" 117 | 118 | #: ../fourier.c:972 119 | msgid "Inverse Fourier transform applied successfully." 120 | msgstr "" 121 | 122 | #: ../fourier.c:972 123 | msgid "Forward Fourier transform applied successfully." 124 | msgstr "" 125 | -------------------------------------------------------------------------------- /po/pt.po: -------------------------------------------------------------------------------- 1 | # gimp3-fourier-plugin 2 | # Copyright (C) 2024 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # Jose Da Silva, 2024. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: gimp30-fourier-plugin\n" 10 | "Report-Msgid-Bugs-To: https://github.com/rpeyron/plugin-gimp-fourier/issues\n" 11 | "POT-Creation-Date: 2024-10-09 00:28+0200\n" 12 | "PO-Revision-Date: 2024-10-06 22:47-0700\n" 13 | "Last-Translator: \n" 14 | "Language-Team: \n" 15 | "Language: pt\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: ../fourier.c:111 21 | msgid "FFT Forward" 22 | msgstr "FFT _Direta" 23 | 24 | #: ../fourier.c:112 25 | msgid "" 26 | "This plug-in applies a FFT to the image, for educational or effects purpose." 27 | msgstr "" 28 | "Este plug-in aplica uma conversão FFT direta à imagem, para fins educacionais ou de efeitos." 29 | 30 | #: ../fourier.c:113 31 | msgid "" 32 | "Apply an FFT to the image. This can remove (for example) moire patterns from images scanned from books:\n\n" 33 | " The image should be RGB (Image|Mode|RGB)\n\n" 34 | " Remove the alpha layer, if present (Image|Flatten Image)\n\n" 35 | " Select Filters|Generic|FFT Forward\n\n" 36 | " Use the preselected neutral grey to effectively remove any moir patterns from the image. Either paint over any patterns or\n\n" 37 | " - In the Layers window, select the layer, and 'Duplicate Layer'\n" 38 | " - Select Colours|Brightness-Contrast. Increase the Contrast to see any patterns.\n" 39 | " - Use the Rectangular and/or Elliptical Selection tools to select any patterns on the contrast layer.\n" 40 | " - Then remove the contrast layer leaving the original FFT layer with the selections.\n" 41 | " - Then select Edit|Fill with FG colour, remembering to cancel the Selection afterwards!\n\n" 42 | " Select Filters|Generic|FFT Inverse\n\n" 43 | "Voila, an image without the moire pattern!" 44 | msgstr "" 45 | "Aplique uma conversão FFT à imagem. Isso pode remover (por exemplo) padrões moiré de imagens digitalizadas de livros:\n\n" 46 | " A imagem deve ser RGB (Imagem|Modo|RGB)\n\n" 47 | " Remova a camada alfa, se presente (Imagem|Achatar imagem)\n\n" 48 | " Escolha Filtros | Genérico | FFT Direta\n\n" 49 | " Use cinza neutro pré-selecionado para excluir seções moir da imagem. Pinte sobre seções ou\n\n" 50 | " - Na janela Camadas, escolha a camada e 'Duplicar Camada'\n" 51 | " - Escolha Cores | Brilho-Contraste. Aumente o contraste para ver qualquer padrões.\n" 52 | " - Use as ferramentas Seleção Retangular e/ou Elíptica para escolher qualquer padrões na camada de contraste.\n" 53 | " - Em seguida, remova a camada de contraste deixando a camada FFT original com as seleções.\n" 54 | " - Então escolha Editar|Preencher com cor FG, lembre-se de cancelar a Seleção depois!\n\n" 55 | " Escolha Filtros | Genérico | FFT Inversa\n\n" 56 | " Voila!, uma imagem sem o padrões moiré!" 57 | 58 | #: ../fourier.c:127 59 | msgid "FFT Inverse" 60 | msgstr "FFT _Inversa" 61 | 62 | #: ../fourier.c:128 63 | msgid "" 64 | "Apply an inverse FFT to the image, effectively restoring the original image " 65 | "(plus changes)." 66 | msgstr "" 67 | "Aplique uma FFT inversa à imagem, restaurando efetivamente a imagem original " 68 | "(mais alterações)." 69 | 70 | #: ../fourier.c:129 71 | msgid "" 72 | "This plug-in applies a FFT to the image, for educationnal or effects purpose." 73 | msgstr "" 74 | "Este plug-in aplica conversão FFT à imagem, para fins educacionais ou de efeitos." 75 | 76 | #: ../fourier.c:477 77 | msgid "_Fourier..." 78 | msgstr "_Fourier..." 79 | 80 | #: ../fourier.c:490 81 | msgid "Mode" 82 | msgstr "Modo" 83 | 84 | #: ../fourier.c:491 85 | msgid "Mode { Foward (0), Inversed (1) }" 86 | msgstr "Modo { Direta (0), Inversa (1) }" 87 | 88 | #: ../fourier.c:496 89 | msgid "Create _new layer" 90 | msgstr "Criar _nova camada" 91 | 92 | #: ../fourier.c:497 93 | msgid "Create a new layer" 94 | msgstr "Crie uma nova camada" 95 | 96 | #: ../fourier.c:634 ../fourier.c:930 97 | msgid "Applying inverse Fourier transform..." 98 | msgstr "Aplicar transformação inversa de Fourier..." 99 | 100 | #: ../fourier.c:634 ../fourier.c:930 101 | msgid "Applying forward Fourier transform..." 102 | msgstr "Aplicar transformação de Fourier direta..." 103 | 104 | #: ../fourier.c:693 105 | #, c-format 106 | msgid "Procedure '%s' only works with one drawable." 107 | msgstr "A função '%s' só funciona com uma única imagem." 108 | 109 | #: ../fourier.c:747 110 | msgid "Fourier" 111 | msgstr "Fourier" 112 | 113 | #: ../fourier.c:756 114 | msgid "_Forward" 115 | msgstr "_Direta" 116 | 117 | #: ../fourier.c:757 118 | msgid "_Inverse" 119 | msgstr "_Inverso" 120 | 121 | #: ../fourier.c:972 122 | msgid "Inverse Fourier transform applied successfully." 123 | msgstr "Transformada inversa de Fourier aplicada com sucesso." 124 | 125 | #: ../fourier.c:972 126 | msgid "Forward Fourier transform applied successfully." 127 | msgstr "Transformação direta de Fourier aplicada com sucesso." 128 | -------------------------------------------------------------------------------- /rpm/gimp-fourier-plugin.spec.in: -------------------------------------------------------------------------------- 1 | # 2 | # spec file for package gimp-fourier-plugin 3 | # 4 | # Copyright (c) 2011 Kyrill Detinov (Version 0.4.1) 5 | # This file and all modifications and additions to the pristine 6 | # package are under the same license as the package itself. 7 | # Modified for autoconf style build by Joe Da Silva (v0.4.3) 8 | # additional mods made here based on fedoraproject and mageia: 9 | # https://src.fedoraproject.org/rpms/gimp-fourier-plugin/blob/rawhide/f/gimp-fourier-plugin.spec 10 | # http://sophie.zarb.org/rpms/28ff35b74220354ba52644c97293d4dd/files/1 11 | # 12 | Name: gimp-fourier-plugin 13 | Version: @FOURIER_VERSION@ 14 | Release: 0 15 | Summary: Do direct and reverse Fourier Transforms on your image 16 | License: GPLv3+ 17 | URL: https://www.lprp.fr/gimp_plugin_en/ 18 | Group: Productivity/Graphics/Bitmap Editors 19 | Source0: https://github.com/rpeyron/plugin-gimp-fourier/archive/v%{version}/plugin-gimp-fourier-%{version}.tar.gz 20 | BuildRequires: autoconf 21 | BuildRequires: automake 22 | BuildRequires: gcc 23 | BuildRequires: make 24 | BuildRequires: pkgconfig(fftw3) 25 | BuildRequires: pkgconfig(gimp-2.0) 26 | BuildRequires: pkgconfig(gtk+-2.0) 27 | Requires: gimp 28 | #Requires: libfftw3 29 | 30 | %description 31 | GIMP Plugin to do forward and reverse Fourier Transform. The major advantage of 32 | this plugin is to be able to work with the transformed image inside GIMP. You 33 | can draw or apply filters in fourier space and get the modified image with an 34 | inverse fourier transform. Useful in fixing moire patterns or fixing some 35 | regular banding noise. 36 | 37 | %prep 38 | %setup -n plugin-gimp-fourier-%{version} 39 | 40 | %build 41 | autoreconf --force --install --verbose 42 | %configure 43 | %make_build 44 | 45 | %install 46 | %make_install 47 | 48 | # Upstream provides no tests. 49 | 50 | %files 51 | %license LICENSE 52 | %doc README.md README.Moire 53 | %{_libdir}/gimp/2.0/plug-ins/fourier 54 | 55 | %changelog 56 | -------------------------------------------------------------------------------- /rpm/gimp3-fourier-plugin.spec.in: -------------------------------------------------------------------------------- 1 | # 2 | # spec file for package gimp3-fourier-plugin 3 | # 4 | # Copyright (c) 2011 Kyrill Detinov (Version 0.4.1) 5 | # This file and all modifications and additions to the pristine 6 | # package are under the same license as the package itself. 7 | # Modified for autoconf style build by Joe Da Silva 8 | # additional mods made here based on fedoraproject and mageia: 9 | # https://src.fedoraproject.org/rpms/gimp-fourier-plugin/blob/rawhide/f/gimp-fourier-plugin.spec 10 | # http://sophie.zarb.org/rpms/28ff35b74220354ba52644c97293d4dd/files/1 11 | # 12 | %define moname gimp30-fourier 13 | 14 | Name: gimp3-fourier-plugin 15 | Version: @FOURIER_VERSION@ 16 | Release: 0 17 | Summary: Do direct and reverse Fourier Transforms on your image 18 | License: GPLv3+ 19 | URL: https://www.lprp.fr/gimp_plugin_en/ 20 | Group: Productivity/Graphics/Bitmap Editors 21 | Source0: https://github.com/rpeyron/plugin-gimp-fourier/archive/v%{version}/plugin-gimp-fourier-%{version}.tar.gz 22 | BuildRequires: autoconf 23 | BuildRequires: automake 24 | BuildRequires: gcc 25 | BuildRequires: make 26 | BuildRequires: libtool 27 | 28 | BuildRequires: pkgconfig(fftw3) 29 | BuildRequires: pkgconfig(gimp-3.0) 30 | BuildRequires: pkgconfig(gtk+-3.0) 31 | #Requires: gimp-3.0 32 | #Requires: lib64fftw3 33 | 34 | %description 35 | GIMP3 Plugin to do forward and reverse Fourier Transform. The major advantage of 36 | this plugin is to be able to work with the transformed image inside GIMP3. You 37 | can draw or apply filters in fourier space and get the modified image with an 38 | inverse fourier transform. Useful in fixing moire patterns or fixing some 39 | regular banding noise. 40 | 41 | %prep 42 | %setup -n plugin-gimp-fourier-%{version} 43 | 44 | %build 45 | autoreconf --force --install --verbose 46 | %configure --enable-gimp3-fourier 47 | %make_build 48 | 49 | %install 50 | %make_install 51 | %find_lang %{moname} 52 | 53 | # Upstream provides no tests. 54 | 55 | %files -f %{moname}.lang 56 | %license LICENSE 57 | %doc README.md 58 | %doc README.Moire 59 | %{_libdir}/gimp/3.0/plug-ins/fourier/fourier 60 | 61 | %changelog 62 | --------------------------------------------------------------------------------