Hi Mikko,
passing 200, 0 should place the old images top left corner to x200,y0 in the new larger image.
No, it's the other way round. The coordinate you specify to the function is the coordinate of the top left corner of the new extent relative to the *old* image whose top left corner is (0,0).
Try this code:
Code: Select all
#include <windows.h>
#include <wand/magick_wand.h>
void test_wand(void)
{
MagickWand *m_wand = NULL;
PixelWand *p_wand;
MagickWandGenesis();
m_wand = NewMagickWand();
p_wand = NewPixelWand();
PixelSetColor(p_wand, "blue");
if(!MagickReadImage(m_wand,"logo:")) {
MessageBox(NULL,"Failed to read logo:","",MB_OK);
} else {
MagickSetImageBackgroundColor(m_wand,p_wand);
MagickExtentImage(m_wand,1024,768,-200,-50);
MagickWriteImage(m_wand,"logo_extent.jpg");
}
/* Tidy up */
m_wand = DestroyMagickWand(m_wand);
p_wand = DestroyPixelWand(p_wand);
MagickWandTerminus();
}
It produces this image to which I've added the coordinate system:
The (0,0) coordinate is at the top left of the logo: image, which is the original one, so the coordinate of the extent's top left is (-200,-50).
Hope this helps.
Pete