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;
{
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;
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);
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 = 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
連結已複製
1 回應
