pixbuf color count
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, Once I have loaded a pixbuf using gdk_pixbuf_new_from_file(filename, &error); Is there a way to get the number of unique colors in that pixbuf. I looked at the docs for ColorMap and it says it only applies to pseudo color images, but I'm not even sure how that would apply in this case. Basically, I just want to know if the image has only a couple of colors in it or more. Thanks, Kevin - -- Get my public GnuPG key from http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFHASUC6w2kMH0L1dERAnRoAJ9FGPRTVadgRPV9nDHJTiod15F2ewCfTT4A +sTtrk2JNK872WiACSOBuZw= =X5iu -END PGP SIGNATURE- ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: pixbuf color count
On Mon, Oct 01, 2007 at 10:49:06AM -0600, Kevin DeKorte wrote: > Is there a way to get the number of unique colors in that pixbuf. gdk-pixbuf is not a full-fledged image manipulation library, it provides just a few basic functions related to loading, saving and on-screen rendering. So you have to either use an image manipulation library or count the distinct colours yourself. Yeti -- http://gwyddion.net/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
re: pixbuf color count
Counting unique colors in a GtkPixbuf should be pretty easy once you know how to access the pixels as an array. The put_pixel() example here gives you everthing you need to know for that: http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html Seems like finding unique colors would be just accessing the pixel array as ints, to compare each int to those in a linked-list you'd make to hold every unique int you'd found so-far. if you only want to see if there are more than two or three colors, then you can even skip the linked list. === * From: Kevin DeKorte * To: gtk-app-devel-list gnome org * Subject: pixbuf color count * Date: Mon, 01 Oct 2007 10:49:06 -0600 -BEGIN PGP SIGNED MESSAGE- Hello, Once I have loaded a pixbuf using gdk_pixbuf_new_from_file(filename, &error); Is there a way to get the number of unique colors in that pixbuf. I looked at the docs for ColorMap and it says it only applies to pseudo color images, but I'm not even sure how that would apply in this case. Basically, I just want to know if the image has only a couple of colors in it or more. Thanks, Kevin ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list