I'm trying to write a standalone c program that can scale jpeg images.
I decided to try and leverage the gimp api via libgimp. Is this
possible ? I can
successfully compile and link the following simple program:
#include <gimp.h>
#include <gimpfileops_pdb.h>
#include "libgimp-include.c"
int main(int argc, char** argv)
{
gint32 img, drawable;
gboolean status;
/* load jpeg */
img = gimp_file_load(GIMP_RUN_NONINTERACTIVE, "myjpeg.jpg",
"myjpeg.jpg");
/ * get drawable - needed to save */
drawable = gimp_image_active_drawable(img);
/* scale the image */
status = gimp_image_scale(img, 50, 50);
/ * save the image */
status = gimp_file_save(GIMP_RUN_NONINTERACTIVE, img, drawable,
"myjpeg2", "myjpeg2");
exit(0);
}
Note: libgimp-include.c contains the following:
GimpPlugInInfo PLUG_IN_INFO =
{
NULL,
NULL,
NULL,
NULL
};
When I execute this program, the following assertion is made:
Glib-CRITICAL : file ghash.c: line 138 (g_hash_table_lookup):
assertion 'hash_table != NULL' failed
LibGimp-ERROR : could not find handler for message: 5
aborting...
Is it possible to use libgimp without creating a plugin ? Any idea how
to get this code to run ?
Thanks for your time and attention to this matter.
-Ben