El dl 26 de 11 del 2007 a les 03:59 -0500, en/na Lea Wiemann va escriure: > Hi, > > I'd like to turn a black background into white, or transparency (in > which case it should look cut if displayed on a white background). My > practical use case is photos of objects with black backgrounds that I'd > like to improve for Wikipedia. The problem is that the boundary between > background and object is usually fuzzy. > > I've created a pair of example images (attached): Say I start off with > the image fuzzy-circle.png (a gray-patterned circle on a black > background); what I would like to get is something like > fuzzy-circle-goal.png (the gray-patterned circle on a white background) > -- but that seems pretty hard to achieve: If I "select by color: black" > and then cut the selection, the corners look either aliased/"too sharp" > (for high thresholds in the select-by-color tool), or they have dark > pixels in them (for low thresholds). Selecting the black background, > growing the selection (2px), feathering it (2px), and then cutting the > selection *kinda* works, but it cuts off the blurry part of the object > boundary. > > Any ideas on this one? > I am doing a script that might help you. It is not specyfic to your purpose but hope it helps.
Install mktpstamp.scm from here to your gimp-version/scripts directory http://fornol.no-ip.org/linux/tuxpaint/scripts Then open Gimp Select by fuzzy select or by color black with threshold 50 Show the layers dialog. add a layer mask inverted from selection You get something like fuzzy-circle-darks-pixels.png you posted Active the image, not the mask, add an alpha channel to it. Select by fuzzy select or by color black with threshold 50 grow the selection by the number of pixels needed to cover the dark ones.(1 or 2) CTRL X to delete all the selection. You get a image that lacks the edge pixels, they will be regenerated from the current edges when running the script. Run mktpstamp (It appears in filters artistic in gimp 2.4.x or in script-fu alquemy on 2.2.xx) Uncheck Scale Create .txt file and Create .dat file If you are confident, select a proper filename and keep Save and close. This will make a transparent .png file Else Change Save and close to Don't save and keep for editing. This will make a new image with 4 layers A backup layer two contrast layers and the working layer. You can then make the contrast layers visible/invisible by turn to check if there is any weird effect. When happy fill the green contrast layer with wite or any color you want, flat the image and save. If you want transparency, do a new image from the top layer(just drag the layer to the toolbox) and save it. More instructions to run it you can find at http://sourceforge.net/mailarchive/forum.php?thread_name=1185622883.26911.151.camel%40hola.fou.net&forum_name=tuxpaint-devel BTW any comments on how to improve it are welcome. > Best wishes, > > Lea Yours Pere
<<attachment: mystamp.png>>
_______________________________________________ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user