Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6708 Discussions

How to change JPEG Iamge size using Intel Library

parulj
Beginner
239 Views
Hi All
i am creating a JPEG File from bitmap using Intel Library. its work fine. but i want to change size of the image. how i can do this. when i change size of the image for jpeg file then if size is less than the original image size then it cut the image of that size and if it is greater than the original size than it append same image two three time. but i want that it should stretch and expand the image according to the size. let me know how i can do this.
below is the code for creating JPEG File
bool CreateJPEG(BYTE* nDataBuffer)
{
DWORD dErr;
JPEG_CORE_PROPERTIES jcprops;
IJLERR jerr;
// Populate JPEG structure
jerr = ijlInit(&jcprops);

if (jerr == IJL_OK)
{
DWORD dib_pad_bytes;
dib_pad_bytes = IJL_DIB_PAD_BYTES(m_bmiHeader.biWidth, 3);
jcprops.DIBWidth = m_bmiHeader.biWidth;
jcprops.DIBHeight = -m_bmiHeader.biHeight;
jcprops.DIBColor = IJL_BGR ;
jcprops.DIBChannels = 3;
jcprops.DIBPadBytes = dib_pad_bytes;
jcprops.DIBBytes = nDataBuffer;// buffer to store 24 bit image
jcprops.JPGSizeBytes = m_bmiHeader.biSizeImage;
jcprops.JPGChannels = 3;
jcprops.jquality = 100;
jcprops.JPGColor = IJL_YCBCR;
//try to increasewidth of the image
jcprops.JPGWidth = m_bmiHeader.biWidth + 100;
jcprops.JPGHeight = -m_bmiHeader.biHeight;
jcprops.cconversion_reqd = FALSE;
jcprops.upsampling_reqd = FALSE;
jcprops.JPGSubsampling = IJL_NONE;


jcprops.JPGFile = pTargetTempFile;
jerr = ijlWrite(&jcprops,IJL_JFILE_WRITEWHOLEIMAGE);

FREEBUFFER (jcprops.DIBBytes );
if(jcprops.JPGFile != NULL)
{
delete [] const_cast(jcprops.JPGFile);
jcprops.JPGFile = NULL;
}
jerr = ijlFree(&jcprops);

if (jerr == IJL_OK)
return true;
else
{
dErr = GetLastError();
m_cUtils.DisplayMessage(dErr, true);
return false;
}
}
else
{
dErr = GetLastError();
m_cUtils.DisplayMessage(dErr, true);
return false;
}
}
Thanks
Parul
0 Kudos
1 Reply
Vladimir_Dudnik
Employee
239 Views

Hi,

as you can see from JPEG library documentation library itself does not resize image. You can use ippiResize function to that.

Regards,
Vladimir

0 Kudos
Reply