bootchk / resynthesizer

Suite of gimp plugins for texture synthesis
GNU General Public License v3.0
1.39k stars 164 forks source link

How to make resynthesizer work with GimpFu-v3? #88

Open rhysday opened 3 years ago

rhysday commented 3 years ago

I'm running GIMP 2.99 and followed your install instructions for GimpFu-v3.

I also installed resynthesizer plugin from the Arch User Repository.

It's not showing in GIMP and I have no idea how to make edits to the plugins to make them work. Is it possible to upload a Resynthesizer GimpFu-v3 version here?

bootchk commented 3 years ago

For resynthesizer to work with Gimp 2.99 and 3.0, with the GimpFuV3 plugin, the plan is:

Convert the resynthesizer plugins from Python 2 to Python 3. (Just a few lines I think, none related to the algorithm itself per se.) Then engine itself (a C language, executable plugin) should still work, AFAIK.

That is the plan. I will test it very soon, and yes, put the converted Python plugins here.

LinuxBeaver commented 3 years ago

I hope it is ported to python3, this is really important. Linux seriously lacks graphic designers which means not many people care. If this plugin becomes abandoned that would be awful.

rautamiekka commented 3 years ago

Seems 2.99.x is at Python 3.6.0.

bootchk commented 3 years ago

The branch "deprecations" has Resynthesizer working on Gimp 2.99.x and Python 3 but like 2.99.x is beta quality, not for production use. And it requires my GimpFu v3 repository, which is even more beta, somewhere between delta and omega. Any of that might change.

cvtsi2sd commented 1 year ago

Question: to fix the current situation, would you accept a rewrite of the scripts that are currently Python as Script-Fu, that hopefully wouldn't be affected by the sad Python 2/3 situation and just depend on plain GIMP?

bootchk commented 1 year ago

Yes, I don't see any problem with that idea. I would put them in the repo and make them installed instead of the Python versions, starting immediately. Keeping the Python versions so users of an older GIMP could get them, but not installing them.

But they must be readable, because I or others would need to maintain them. I suggest you start with one, either the most commonly used Heal Selection, or one that is smaller. Then I would review and test, before merging. You would not even need to port them all, but I would insist on at least Heal Selection.

Thanks

cvtsi2sd commented 1 year ago

Great! I started working on heal selection yesterday; given that these are mostly just glue code that invokes GIMP routines, the translation is pretty much 1:1.

Keeping the Python versions so users of an older GIMP could get them, but not installing them.

In theory the Script-Fu versions should be able to work on all GIMP versions, at least all the GIMP 2 series, so I'm not sure why this would be necessary exactly. BTW even for Script-Fu I've seen there's some minor difference in the scripting interface in GIMP 3, but it should be possible to write a single script that works on both major versions.

kernc commented 1 year ago

Keeping the Python versions

This would be necessary for everyone else to be able to read/comprehend/verify the algos. 😅

bootchk commented 1 year ago

even for Script-Fu I've seen there's some minor difference

FYI I am helping maintain ScriptFu in GIMP v3. There are a few more planned changes. But I agree, the differences probably won't affect most plugins. Let me know if you find some snag.

cvtsi2sd commented 1 year ago

Hello, sorry for the long wait, but I've been held back by several other projects, and I got stuck on a very stupid bug. So, here's my conversion for the heal selection plugin, which seems to work correctly, at least AFAICT.

healselection.zip

In the rewrite, I followed the original pretty much line by line (comments included); now that it works I should at least make the variable names a bit more scheme-like (kebab-case I think that's called). The main difference is in how the crop parameters are computed: instead of working with origin and width/height I used the TL/BR coords and computed the origin+width/height values only when calling crop, as it made for simpler code. Also, the time.sleep debug trick before closing the debug image couldn't be done (IDT I have sleep in this scheme), so if debug is enabled I just leave the debug image there, to be closed manually.

For GIMP 3 compatibility I introduced a gbool local function to handle the fact that in GIMP 2 APIs failure/success is (0) and (1), while in GIMP 3 it should be #f and #t; still, I only tested it with GIMP 2.10, so IDK if it actually works in GIMP 3.

If this looks good for you I can refine it, possibly start a PR and then start working on the other scripts.

cvtsi2sd commented 1 year ago

Meanwhile I forked and created my own branch for this stuff... in the current commit I already did all the renames I talked about, the previous one still sports the old names

https://github.com/cvtsi2sd/resynthesizer/blob/script-fu-ize/PluginScripts/plugin-heal-selection.scm

Shoeboxam commented 1 year ago

After snooping around the forks, I see @itr-tert has written a scheme version here: https://github.com/itr-tert/gimp-resynthesizer-scm

cvtsi2sd commented 1 year ago

So apparently I learned Scheme for nothing :smile: oh well, it was fun anyhow.

kernc commented 1 year ago

I'd certainly be nice if some of the good improvements from these repos were eventually merged back in here, so that they get released as the next version and shipped via gimp-plugin-registry to potentially hundreds of thousands of users of Debian and Ubuntu derivatives!