GNOME Bugzilla – Bug 62087
Add edge size option to "Old Photo"
Last modified: 2005-05-19 17:48:48 UTC
I would appreciate it, if the "Old Photo" effect was modified, so the user can choose the edge size.
Well, I am not sure if this is a bug, but if you the bug hunting team agree with Jacob, then I have got a fix for you. Even if you don't, at least another satisfied customer may leave the building. ;-) -----begin udiff----- --- old_photo.scm Tue Mar 28 21:06:36 2000 +++ new-old_photo.scm Wed Oct 24 23:26:12 2001 @@ -19,14 +19,17 @@ ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +; Branko Collin <collin@xs4all.nl> added the possibility to change the border size in October 2001. + ; Define the function: -(define (script-fu-old-photo inImage inLayer inDefocus inBorder inSepia inMottle inCopy) +(define (script-fu-old-photo inImage inLayer inDefocus inSepia inMottle inCopy inBorderSize) (gimp-selection-all inImage) (set! theImage (if (= inCopy TRUE) (car (gimp-channel-ops-duplicate inImage)) inImage) ) + (if (> inBorderSize 0) (set! inBorder TRUE) (set! inBorder FALSE)) (set! theLayer (car(gimp-image-flatten theImage))) (if (= inDefocus TRUE) @@ -35,7 +38,7 @@ ) (if (= inBorder TRUE) (script-fu-fuzzy-border theImage inLayer '(255 255 255) - 20 TRUE 8 FALSE 100 FALSE TRUE ) + inBorderSize TRUE 8 FALSE 100 FALSE TRUE ) () ) (set! theLayer (car(gimp-image-flatten theImage))) @@ -80,7 +83,7 @@ (script-fu-register "script-fu-old-photo" _"<Image>/Script-Fu/Decor/Old Photo..." - "Makes the image look like an old photo" + "Makes the image look like an old photo. A border size of 0 means no border." "Chris Gutteridge" "1998, Chris Gutteridge / ECS dept, University of Southampton, England." "16th April 1998" @@ -88,8 +91,10 @@ SF-IMAGE "The Image" 0 SF-DRAWABLE "The Layer" 0 SF-TOGGLE _"Defocus" TRUE - SF-TOGGLE _"Border" TRUE SF-TOGGLE _"Sepia" TRUE SF-TOGGLE _"Mottle" FALSE SF-TOGGLE _"Work on Copy" TRUE + SF-ADJUSTMENT _"Border size" '(0 0 300 1 10 0 1) ; since this plug-in uses + ; the fuzzy-border plug-in, I used the values of the latter, with the + ; exception of the initial value and the 'minimum' value. ) ------end udiff------ Here's a rundown of what I did: I changed the order of the interface elements in the script's dialog, so that checkboxes line up with check boxes. I changed EXPECTED BEHAVIOUR! Instead of defaulting to a border, the script will now default to NO border. I felt that with the new interface this would be more intuitive. In the old UI, changing from generating a border to having no border was just one mouseclick away. In the new UI, this would require more user action. Instead of (un)checking a checkbox, the use now has to set border size to 0 (zero) for no border or higher for a border of the required size. It would be nice to be able to have a checkbox _and_ an ADJUSTEMENT field, but I would have to be able to grey out the ADJUSTMENT field if the Border checkbox weren't checked, and I do not know if that is possible. HTH,
Thanks for the patch. But I am wondering why you set the initial border size to 0. Setting it to 20 would preserve the compatibility with the default behavior of the old script. The users will easily understand that moving the slider to 0 will not add a border (and if they do not guess it, they will read it in the help message). Several other scripts have a similar slider with an initial value that is not 0 or maximum. Regarding the checkbox and the slider, it is unfortunately (AFAIK) not possible in Script-Fu to deactivate one widget depending on the value of the other. But I do not think that it is necessary anyway. Everybody should understand that adding 0 to something is the same as not doing anything.
Hi Raphael, I set the slider to 0 (and with that, changed expected behaviour), because of the following: in the 'old' situation, the choice was binary. Either you did or did not get a border. Setting the border on or off was a matter of a single mouse click and which it defaulted to was really rather trivial. In the new situation, however, changing from a 20 pixel border to no border (0 'pixels') requires more action and alertness of the user. However, I changed my mind again: if you do decide to include this patch in a later distribution of the GIMP or of the plug-in, please set the border size to 20. After all, there is no way the user can guess that this used to be the old value. Breaking user expectations is not desirable in this case. The best solution would still be a border checkbox that will grey out the border size selector if the checkbox becomes deselected. That is not going to happen, I fear, so I am in favor of setting border size to 20 by default.
I just noticed that Davide Galimberti has added a plug-in to the plug-in registry, called old-photo-2, which also adds a border size slider (along with a border toggle!) and a mottle-size slider. You can find his plug-in at http://registry.gimp.org/plugin?id=1063.
Branko, would you mind to attach an updated version of your patch to this report? The inline patch is not useable due to line breaks inserted by bugzilla.
Removed the PATCH keyword since there is no useable patch attached to this report. Perhaps Branko can attach an updated version.
Created attachment 15804 [details] [review] Unified diff to 1.2 old_photo.scm
Created attachment 15805 [details] Version of old_photo.scm that supports user defined border width
I hope this works. The first attachment is the diff. Just to be sure, I included the modified script (note the file name) as the second attachment. Should you need more, please let me know.
Of course this patch didn't apply cleanly to the 1.3 tree but I wanted some modifications anyway... 2003-04-17 Sven Neumann <sven@gimp.org> * plug-ins/script-fu/scripts/old-photo.scm: applied a modified version of a patch from Branko Collins that makes the border size configurable (bug #62087).
Collin_s_?
Sorry about the typo, fixed in CVS.
Verified, against gimp 2.3.0