Page 1 of 1

Magick++ resize 2 image to get the same size!

Posted: 2008-07-18T05:25:37-07:00
by imagetester
Hi I want to compare two image with MeanErrorPerPixel function. But it requires that the two images have the same size.

I 've written a code that enables resizing but i've noticed that when i change the width the height also changes and vice versa. So i'm not able to resize to the same size.

Code: Select all

// I'm resizing the images to the smaller one

Image one=v_image[0];
Image two=v_image[1];

if(one.size().width()>two.size().width()){
	Geometry scale(two.size().width(),one.size().height());
	one.resize(scale);
}
else{
	Geometry scale(one.size().width(),two.size().height());
	two.resize(scale);

}


if(one.size().height()>two.size().height()){
	Geometry scale(one.size().width(),two.size().height());
	one.resize(scale);
}
else{
	Geometry scale(two.size().width(),one.size().height());
	two.resize(scale);
}
Original sizes:
one:148-155
two:211-171

After resize:
one:115-120
two:145-120

Expected result:( not done )
one:148-155
two:148-155


I really need this to work, thanks in advance

Re: Magick++ resize 2 image to get the same size!

Posted: 2008-07-18T06:46:22-07:00
by imagetester
Ok, found it guys it is .extent(Geometry x) not .resize(Geometry x)

Thanks anyways,

Re: Magick++ resize 2 image to get the same size!

Posted: 2008-07-20T07:32:37-07:00
by imagetester
Not really done!!
The extent function doesn't resize the image at all!

I've tried .zoom .scale .sample .resize and all with the same result !!!!

Is their anyway to resize two images to get exactly the same size ???????
I need this same size to be able to compare them later with the compare function!!

Thanks in advance

Re: Magick++ resize 2 image to get the same size!

Posted: 2008-07-23T00:34:35-07:00
by anthony
Add a '!' to the resize gemetry!!!
http://imagemagick.org/Usage/resize/#aspect