This commit is contained in:
parent
e93850bb01
commit
5a38b5378e
|
@ -268,18 +268,21 @@ HGResult HGAPI HGImgFmt_SaveImageToTiffWriter(HGTiffWriter writer, HGImage image
|
|||
HGBase_GetImageInfo(image, &imgInfo);
|
||||
if (HGBASE_IMGTYPE_BGR == imgInfo.type)
|
||||
{
|
||||
if (HGBASE_ERR_OK != HGBase_CloneImage(image, HGBASE_IMGTYPE_RGB, HGBASE_IMGORIGIN_TOP, &image2))
|
||||
HGBase_SetImageROI(image, &roi);
|
||||
HGBase_CloneImage(image, HGBASE_IMGTYPE_RGB, HGBASE_IMGORIGIN_TOP, &image2);
|
||||
}
|
||||
else if (HGBASE_IMGTYPE_BGRA == imgInfo.type)
|
||||
{
|
||||
if (HGBASE_ERR_OK != HGBase_CloneImage(image, HGBASE_IMGTYPE_RGBA, HGBASE_IMGORIGIN_TOP, &image2))
|
||||
HGBase_SetImageROI(image, &roi);
|
||||
HGBase_CloneImage(image, HGBASE_IMGTYPE_RGBA, HGBASE_IMGORIGIN_TOP, &image2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (HGBASE_ERR_OK != HGBase_CloneImage(image, imgInfo.type, HGBASE_IMGORIGIN_TOP, &image2))
|
||||
HGBase_SetImageROI(image, &roi);
|
||||
HGBase_CloneImage(image, imgInfo.type, HGBASE_IMGORIGIN_TOP, &image2);
|
||||
}
|
||||
|
||||
if (NULL == image2)
|
||||
{
|
||||
HGBase_SetImageROI(image, &roi);
|
||||
return HGBASE_ERR_FAIL;
|
||||
}
|
||||
|
||||
HGBase_GetImageInfo(image2, &imgInfo);
|
||||
|
@ -339,7 +342,7 @@ HGResult HGAPI HGImgFmt_SaveImageToTiffWriter(HGTiffWriter writer, HGImage image
|
|||
TIFFSetField(tif, TIFFTAG_XRESOLUTION, info->xResolution);
|
||||
TIFFSetField(tif, TIFFTAG_YRESOLUTION, info->yResolution);
|
||||
|
||||
if (info->compression == HGIMGFMT_TIFFCOMP_JPEG)
|
||||
if (HGIMGFMT_TIFFCOMP_JPEG == info->compression && HGBASE_IMGTYPE_RGB == type)
|
||||
{
|
||||
TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
|
||||
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);
|
||||
|
|
Loading…
Reference in New Issue