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

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
imagetester

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

Post 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
imagetester

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

Post by imagetester »

Ok, found it guys it is .extent(Geometry x) not .resize(Geometry x)

Thanks anyways,
imagetester

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

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post by anthony »

Add a '!' to the resize gemetry!!!
http://imagemagick.org/Usage/resize/#aspect
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply