Page 1 of 1

the difference image size between before and after about resize

Posted: 2016-02-13T07:30:41-07:00
by u24c02
Dear all,

I have some problem about ImageMagicK Resize function.

I found that are some difference between Original image size and resized image size after I use resize().

the code like this,
m_b = m_image; //Original Image Size is 2000x1312
m_b.resize("256x167");

PixelPacket *Pixels = m_image.getPixels(0,0,m_image.columns(),m_image.rows());
PixelPacket *bPixels = m_b.getPixels(0,0,m_b.columns(),m_b.rows());
m_b.resize("2000x1312");

int w = m_image.columns(); //2000
int h = m_image.rows();//1312
int bw = m_b.columns();//2000
int bh = m_b.rows();//1310 ??????????????????????

What am I suppose to do for solving?

Re: the difference image size between before and after about resize

Posted: 2016-02-15T14:29:40-07:00
by glennrp
If you want to resize to exact dimensions (and inexact aspect ratio), use an exclamation point:

Code: Select all

m_b.resize("2000x1312!");
I am assuming that your programming interface will
handle the geometry string the same way that the commandline does.