You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

yoniekai

Beginner

  • "yoniekai" is male
  • "yoniekai" started this thread

Posts: 22

Location: Philippines

  • Send private message

1

Tuesday, February 12th 2008, 4:35pm

access violations opening images using imagemagick classes

i tried the example on how to display the Magick::Image object to a QWidget. when i open an image though, it has an error of "access violation writing in location" and it points at image.read or sometimes at blobs. here is the code

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
   QPixmap pix;
   QString fileName = QFileDialog::getOpenFileName(this,
                                    tr("Open File"), QDir::currentPath());
	if (!fileName.isNull()) {
   	// Read file from disk
		Image image;
		image.read( fileName.toStdString() );
	 
	   // Write to some BLOB in XPM format
	   Blob blob;
	   image.magick( "XPM" ); // Set XPM
	   image.write( &blob );
		
		// Passing Image Buffer to a QPixmap
		const QByteArray imgData ((char*)(blob.data()));
		pix.loadFromData(imgData);

		// Setting the QPixmap
		imageLabel->setPixmap(pix);
                [miscellaneous]


anybody knows why? thanks

This post has been edited 1 times, last edit by "yoniekai" (Feb 12th 2008, 4:36pm)


2

Wednesday, February 13th 2008, 2:57pm

RE: access violations opening images using imagemagick classes

>>const QByteArray imgData ((char*)(blob.data()))
Maybe blobs data not necessary ends with \0?
try

Source code

1
QByteArray pixdata((const char*)blob.data(), blob.length());
Fighting fire with fire.
Three can keep a secret if two of them are dead.

yoniekai

Beginner

  • "yoniekai" is male
  • "yoniekai" started this thread

Posts: 22

Location: Philippines

  • Send private message

3

Wednesday, February 13th 2008, 3:09pm

no luck man, same error.

i've built Qt statically, and im using the dll version of imagemagick. does that have anything to do with it?

yoniekai

Beginner

  • "yoniekai" is male
  • "yoniekai" started this thread

Posts: 22

Location: Philippines

  • Send private message

4

Friday, February 15th 2008, 12:58pm

it was actually my project settings, i've set it to multi threaded debug dll, when you need to set it to multi threaded dll. :( works now

5

Thursday, February 28th 2008, 6:27am

Hi

thanks, it was a useful thread. But, I could not find the same setting in visual studio 6.0 and do you also know how to achieve the same in qt pro file?

Regards,
Manoj

6

Thursday, February 28th 2008, 6:54am

I even found the way to set in Visual Studio 6 and its bydefault set to Multithreaded dll. It still does not work!