Ok, for the first 4 to 5 weeks, I attempted the source approach because it seemed the most appropiate since I'm trying to write source. I tried downloading several versions of the source files from ImageMagick (even some older versions that I have archived in my library drive) and started following the directions. Please note, that between each attempt, I reloaded my computer from the restore disks so that there would be no conflict from previous attempts. In each attempt, the configure.dsw in the VisualMagic\configure folder seemed to build and run without any problems. The only change I made in the configure program was the option to create the dsw for vc++ 6.0 due to my requirements. After running the configure program then navigating to the VisualDynamicMT.dsw workspace and loading it, now it got nasty. I tried (several versions of the source files) to build and run the VisualDynamicMT.dsw as instructed (all, release, etc.) and ended up with a mound of errors (as I noticed from forum postings, lots of people have had), to which, never compiled. I battled with this for several weeks until I decided to try the "binary" approach.
The binary approach, well, I got a little further here. I installed (again several versions with the same tactics I used for the source attempts) the binary version of ImageMagick with the Magick++ option checked. I have been using PerlMagick for several years which is why I wanted to stay with it during my c++ quest, because, I just like it, and, I'm familiar with ImageMagicks' approaches. In fact, the program I'm trying to write in c++ is to be a port of a program I wrote in PerlMagick. I'm attempting to do this in c++ because the perl version has a couple of memory leaks and crashes every once in a while (days) and the computer has to be rebooted, but that's another issue. I have researched the perl2exe compiler and discovered it's not real efficient, and it actually packs a portion of the perl interpeter into the exe. Also, I really didn't want to have to install perl on every computer that I wanted to use this program (talk about in-efficiancy). Anyhow, back to my novel; After installing ImageMagick with it's appropiate options then adding a couple of paths to vc++ 6.0 so it could find the Imagemagick Files...
Code: Select all
C:\PROGRAM FILES\IMAGEMAGICK-6.8.4-Q16\INCLUDE
C:\PROGRAM FILES\IMAGEMAGICK-6.8.4-Q16\INCLUDE\MAGICK
C:\PROGRAM FILES\IMAGEMAGICK-6.8.4-Q16\INCLUDE\MAGICK++
Code: Select all
#pragma comment(lib, "CORE_RL_Magick++_.lib")
#pragma comment(lib, "CORE_RL_Magick_.lib")
#include <Magick++.h>
#include <windows.h>
#include <string>
#include <list>
using namespace std;
using namespace Magick;
char *ImageName = "tigger.gif";
char *NewImageName = "test.gif";
int main( int /*argc*/, char ** argv) {
InitializeMagick(*argv);
try {
list<Image> ImageFrame;
readImages(&ImageFrame,ImageName);
writeImages(ImageFrame.begin(),ImageFrame.end(),NewImageName);
}
catch(exception &error_) {
printf("Exception Error:\n%s\n",error_.what());
return 1;
}
return 0;
}
So far, so good. As a footnote; the program I'm developing will read in an image (like from a camera) and then compares it to an image I have already saved (ie; motion) and decide whether or not to save the new image then create a seperate animation file. Again, I'm doing this with PerlMagick now. But, back to the novel; I started to do some document reading for Magick++, and supposidly, I should be able to use "ImageFrame.read(ImageName)" (with the proper "Image ImageFrame" declaration) for just one "frame" image instead of the multiple frame read I'm using above. Therefore, I attempted this:
Code: Select all
#pragma comment(lib, "CORE_RL_Magick++_.lib")
#pragma comment(lib, "CORE_RL_Magick_.lib")
#include <Magick++.h>
#include <windows.h>
#include <string>
#include <list>
using namespace std;
using namespace Magick;
char *ImageName = "tigger.gif";
char *NewImageName = "test.gif";
int main( int /*argc*/, char ** argv) {
InitializeMagick(*argv);
try {
Image ImageFrame;
ImageFrame.read(ImageName);
ImageFrame.write(NewImageName);
}
catch(exception &error_) {
printf("Exception Error:\n%s\n",error_.what());
return 1;
}
return 0;
}
Code: Select all
Compiling...
Prog.cpp
Linking...
Prog.exe - 0 error(s), 0 warning(s)
I'm not fluent with c++, I'm learning as I go, but I am pretty good with assembly(machine) code, basic (of course), and perl, I have written several programs in those languages, but, as windows gets more complicated, it's getting harder to implement assembly into windows, which is why I'm hitting C++.
In closing my little novel here, my goal is to hopefully find someone out there that has successfully got Magick++, VC++ 6.0, and Windows XP to work together so the "ImageFrame.read" function, along with (I'm sure), "ImageFrame.compare" functions work in their source so I can continue my little adventure (Preferably, an idiots step by step *heh*). I'm sure I'm missing something, somewhere, somehow, but, without much documentation on the net about windows on this topic, I'm hoping someone can help with (maybe) an example of a simple read/write source using Magick++ with the appropiate "links", includes, headers, required (that I seem to be missing) to make it work with a fresh VC++ 6.0 with service pack and redistributable install similar to my example above.
Thanx for taking the time to read this. Your web browser will recieve a cookie soon.
-Gary