I'm working on image editing application using GTK+ and imagemagick. Everything was fine when I was running my app on Linux or win XP, but when I run it on win7 something strange happens. MagickCore's modulateImage method adds horizontal lines to the image. Example image:
turns into:
Here is minimal working code:
Code: Select all
#include <gtk/gtk.h>
#include <iostream>
#include <wand/MagickWand.h>
int main( int argc, char *argv[])
{
gtk_init(&argc, &argv);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
GError* error=NULL;
GdkPixbuf* _pixbuf = gdk_pixbuf_new_from_file("gps-photolinkfountain2.jpg",&error);
if (error != NULL) exit(1);
Image *magickImage;
ExceptionInfo ex;
GetExceptionInfo(&ex);
guchar* _pixels = gdk_pixbuf_get_pixels(_pixbuf);
int _w = gdk_pixbuf_get_width(_pixbuf);
int _h = gdk_pixbuf_get_height(_pixbuf);
magickImage = ConstituteImage(_w,_h,"RGB",CharPixel,_pixels,&ex);
if (ex.severity != UndefinedException) CatchException(&ex);
if (magickImage == (Image *) NULL) exit(1);
//!Modulate makes unexpected effect
ModulateImage(magickImage,"100,100,100");
//!SigmoidalContrast works fine
// SigmoidalContrastImage(magickImage,(MagickBooleanType)true,"40");
ExportImagePixels( magickImage, 0, 0, _w, _h, "RGB", CharPixel, _pixels, &ex );
if(ex.severity != UndefinedException) CatchException(&ex);
GtkWidget *image = gtk_image_new_from_pixbuf (_pixbuf);
gtk_container_add(GTK_CONTAINER(window), image);
g_signal_connect_swapped(G_OBJECT(window), "destroy",
G_CALLBACK(gtk_main_quit), G_OBJECT(window));
gtk_widget_show_all(window);
gtk_main();
}
It does not matter if I compile my application on winXP and migrate executable file to win7 or compile it on win7.
My System:
- Windows 7 Professional 32-bit
- Intel Atom N450
- Imagemagick 6.6.9 32Bit but I've tried other binary releases(6.6.8 or 6.6.10) from http://www.imagemagick.org/script/binar ... hp#windows
- GTK+2.2 - I have tried other versions.
- Code::Blocks 10.05 with integrated MinGW
Am I doing something wrong (and maybe how to fix it) or is it a Imagemagick's or win7 bug?
Best regards
Sebastian