error C3861: 'AcquireImagePixels': identifier not found

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
LiloLilo

error C3861: 'AcquireImagePixels': identifier not found

Post by LiloLilo »

Hi all!

I am new on Magick++, so I need some help for start. I wrote this simple code that load an image from command line and then create a pixel cache to access pixels in read-only. I found out that the line with AcquireImagePixels doesn't compile with error on Visual C++ 2008 Express Edition:

error C3861: 'AcquireImagePixels': identifier not found

but using getConst instead it works. Why?

Thank you all for help

Code: Select all

#include <iostream>
#include <Magick++.h>


using namespace std;
using namespace Magick;


int main(int argc, char * argv[]) {

	if (argc != 2) { cout << "\nUsage: EncodeBRM ImageFileName\n"; exit(1); }

	cout << "\nInitializing ImageMagick library..."; InitializeMagick(* argv); cout << "Done.";


	try {

		cout << "\nLoading source image..."; Image SourceImage; SourceImage.read(argv[1]); cout << "Done.";

		cout << "\nImage info: " << SourceImage.columns() << "x" << SourceImage.rows() << "x" << SourceImage.depth() << "bpp " << SourceImage.format();
		
		cout << "\nConverting to BRM...";

		Pixels SourceImageCache(SourceImage);

		const PixelPacket * pSourceImage = SourceImageCache.getConst(0, 0, SourceImage.columns(), SourceImage.rows());

		//const PixelPacket * pSourceImage = AcquireImagePixels(SourceImage, 0, 0, SourceImage.columns(), SourceImage.rows());

	} catch(exception &MagickError) { cout << "\nImageMagick exception: " << MagickError.what() << endl; return(1); }
}
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: error C3861: 'AcquireImagePixels': identifier not found

Post by magick »

AcquireImagePixel() is a MagickCore method so it requires the MagickLib:: namespace prefix. Instead use getConstPixels() which is a Magick++ method.
LiloLilo

Re: error C3861: 'AcquireImagePixels': identifier not found

Post by LiloLilo »

magick wrote:AcquireImagePixel() is a MagickCore method so it requires the MagickLib:: namespace prefix. Instead use getConstPixels() which is a Magick++ method.
It works! Thank you for help :D
Post Reply