Script-Fu - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Script-Fu (/Thread-Script-Fu) Pages:
1
2
|
RE: Script-Fu - Ofnuts - 12-27-2023 (12-27-2023, 09:25 AM)Alan Wrote: Is there any option that we create a new layer that has the curvy shape and save it as xcf so any image pasted to this layer will look curvy? No; What you can perhaps to is save a path, and then use a script that converts the path into data for curve-bend. RE: Script-Fu - rich2005 - 12-27-2023 (12-27-2023, 09:25 AM)Alan Wrote: Is there any option that we create a new layer that has the curvy shape and save it as xcf so any image pasted to this layer will look curvy? Maybe a possibility. Another way to bend is a displacement map. While the on canvas tool is a GEGL function the devs do have a compatibility plug-in-displace which might be easier than curve-bend to code. Just a quick example: [attachment=10942] RE: Script-Fu - Ofnuts - 12-27-2023 (12-27-2023, 01:00 PM)rich2005 Wrote:(12-27-2023, 09:25 AM)Alan Wrote: Is there any option that we create a new layer that has the curvy shape and save it as xcf so any image pasted to this layer will look curvy? Yes, but you have to be able to generate that displace map... In fact I looked into that problem(*), and for performance reasons, you want to create the displace map in one go (not pixel by pixel, and possibly even avoid line by line), and you can generate a single gradient only if the displace value depends only on the X or Y coordinate (and not on both) which is isn't the case here. To make things a bit more difficult, nothing says that the required transform is linear (IMHO you would need at least one more line in the middle in additions to the two at the top/bottom, and you want the reciprocal transform, because a displace map doesn't tell where a pixel of the source goes, but where a pixels in the result comes from. So, not unfeasible, but to the person ho undertakes it, best of luck. (*) because my ofn-flatten-cylinder script uses a displace map, which in this case is workable for the simple cases. RE: Script-Fu - rich2005 - 12-27-2023 I can appreciate that, if you have to make a map for any image set. Looking at the OP's post #8 an image planted on a cup. It might be a standard background with some image set to the required shape, then you might get away with a pre-made map .....Maybe as a sales demo. RE: Script-Fu - Ofnuts - 12-27-2023 Ah, for this.... 1) You can use Map object and figure out a way to determine the cylinder parameter that fits 2) Otherwise, it is all mathematically computable, because the vertical distortion is due to the angle of shoot and distance of the camera, and anyway the most important transform in the "wrap" around the cylinder (exactly the opposite of what ofn-flatten-cylinder does). RE: Script-Fu - Alan - 12-28-2023 So, what I understand from you guys is to stay with the curve bend operation? The problem is that the script that i am preparing will be taking the place of the psd in our project, but for the admin side it will be like a lot of data to provide (there's a lot of different products with different shapes) so it's not that easy to add the curve bend because it takes a lot of data. I have done the script that do all the job but i just need a help to see if there is something other than the curve bend that takes less data to make it easier for the admins. RE: Script-Fu - Ofnuts - 12-28-2023 (12-28-2023, 07:39 AM)Alan Wrote: So, what I understand from you guys is to stay with the curve bend operation? Using a path is doable, but difficult. Or you save the curve-bend data in a side file. 0r change the scanner, because there are scanners for books (accept different thicknesses on each side) where the page bend is kept to a minimum. |