Re: RFE: pixelate selected area



On Thu, 2008-09-18 at 09:41 -0400, Brian J. Murrell wrote:
> A really nice editing feature would be the ability to pixelate a
> selected area of a photo.  The use case is for uploading photos to a web
> gallery but perhaps there are people in the picture who don't want their
> faces splashed all over the web.

To put my money where my mouth is (or code where my fingers are), here
is a patch for an addin to black out a selected area in a photograph:

diff -Nur ../f-spot-0.5.0/extensions/Editors/BlackoutEditor/BlackoutEditor.addin.xml ./extensions/Editors/BlackoutEditor/BlackoutEditor.addin.xml
--- ../f-spot-0.5.0/extensions/Editors/BlackoutEditor/BlackoutEditor.addin.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./extensions/Editors/BlackoutEditor/BlackoutEditor.addin.xml	2008-09-18 20:31:16.000000000 -0400
@@ -0,0 +1,15 @@
+<Addin namespace="FSpot"
+	id="BlackoutEditor"
+	version="0.5.0.0"
+	name="BlackoutEditor"
+	description="Blackouts the image horizontally."
+	author="Ruben Vermeersch"
+	url="http://f-spot.org/Extensions";
+	category="Editors">
+	<Dependencies>
+		<Addin id="Core" version="0.5.0.0"/>
+	</Dependencies>
+	<Extension path = "/FSpot/Editors">
+		<Editor editor_type = "FSpot.Addins.Editors.BlackoutEditor"/>
+	</Extension>
+</Addin>
diff -Nur ../f-spot-0.5.0/extensions/Editors/BlackoutEditor/BlackoutEditor.cs ./extensions/Editors/BlackoutEditor/BlackoutEditor.cs
--- ../f-spot-0.5.0/extensions/Editors/BlackoutEditor/BlackoutEditor.cs	1969-12-31 19:00:00.000000000 -0500
+++ ./extensions/Editors/BlackoutEditor/BlackoutEditor.cs	2008-09-18 22:31:07.000000000 -0400
@@ -0,0 +1,31 @@
+/*
+ * BlackoutEditor.cs
+ *
+ * Author(s)
+ * 	Brian J. Murrell <brian interlinx bc ca>
+ *
+ * This is free software. See COPYING for details.
+ */
+
+using FSpot;
+using FSpot.Editors;
+using Gdk;
+using Mono.Unix;
+using System;
+
+namespace FSpot.Addins.Editors {
+    class BlackoutEditor : Editor {
+        public BlackoutEditor () : base (Catalog.GetString ("Blackout"), "object-blackout") {
+			CanHandleMultiple = true;
+        }
+
+        protected override Pixbuf Process (Pixbuf input, Cms.Profile input_profile) {
+			Pixbuf output = input.Copy ();
+
+			Pixbuf sub = new Pixbuf (output, State.Selection.x, State.Selection.y,
+					State.Selection.width, State.Selection.height);
+			sub.Fill(0x00000000);
+			return output;
+        }
+    }
+}
diff -Nur ../f-spot-0.5.0/extensions/Editors/BlackoutEditor/Makefile ./extensions/Editors/BlackoutEditor/Makefile
--- ../f-spot-0.5.0/extensions/Editors/BlackoutEditor/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ ./extensions/Editors/BlackoutEditor/Makefile	2008-09-18 20:32:34.000000000 -0400
@@ -0,0 +1,29 @@
+all: BlackoutEditor.dll
+
+PACKAGES = \
+	-pkg:f-spot \
+	-pkg:gtk-sharp-2.0
+
+ASSEMBLIES = \
+	-r:Mono.Posix
+
+RESOURCES = \
+	-resource:BlackoutEditor.addin.xml
+
+SOURCES = \
+	BlackoutEditor.cs
+
+install: all
+	cp *.dll ~/.gnome2/f-spot/addins/
+
+mpack: BlackoutEditor.dll
+	mautil p BlackoutEditor.dll
+
+BlackoutEditor.dll: $(SOURCES) BlackoutEditor.addin.xml
+	gmcs -target:library $(SOURCES) $(PACKAGES) $(ASSEMBLIES) $(RESOURCES)
+
+clean:
+	rm -f *.dll *~ *.bak .mpack
+
+PHONY:
+	install clean all mpack

Pixelate is next.  I wonder if I can find a nice easy pixelate algorithm
to implement or if I will have to invent my own.

Cheers,
b.

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]