how to get depth of png files
Posted: 2013-06-30T20:28:35-07:00
I'm using MagickCore to get depth of png files, (Version ImageMagick-6.7.8) but it doesnot work correctly, I have 32-bit and a 8-bit png pictures, but im tells them depth are same as 8-bit, it's so strange.
Code: Select all
Image *images = NULL, *thumbnails = NULL;
ngx_buf_t* buf = NULL;
size_t len;
u_char *inputblob = NULL, *outputblob = NULL;
ImageInfo *image_info = NULL;
ExceptionInfo *exception = NULL;
exception = AcquireExceptionInfo();
buf = &(image_bean->src_image);
inputblob = buf->pos;
len = buf->last - buf->pos;
image_info = CloneImageInfo((ImageInfo *) NULL);
images = BlobToImage(image_info, inputblob, len, exception);
if (exception->severity != UndefinedException || images == (Image *) NULL)
{
if(images != (Image *) NULL)
{
images = DestroyImageList(images);
}
image_info = DestroyImageInfo(image_info);
exception = DestroyExceptionInfo(exception);
return;
}
thumbnails = SampleImage(images, width, height, exception);
printf("thumbnails->depth=%d ", (int)thumbnails->depth);