the difference image size between before and after about resize

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
u24c02
Posts: 2
Joined: 2015-05-15T06:59:38-07:00
Authentication code: 6789

the difference image size between before and after about resize

Post 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?
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

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

Post 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.
Post Reply