Hi all,
I'm rewriting an import class for imagemagick7, lots of nice improvements, thank you.
I'd like to be able to call PingImage() and then get the number of channels with GetPixelChannels(image), but this seems to return 0, at least for JPEG images. It seems I can only use GetPixelChannels() after ReadImage().
Is this correct? Is there any way to get the number of channels without decoding the whole image?
imagemagick7, MagickCore: GetPixelChannels(image) not valid after PingImage()?
Re: imagemagick7, MagickCore: GetPixelChannels(image) not valid after PingImage()?
You could try calling InitializePixelChannelMap(image), before you call GetPixelChannels(). The channel map is initialized when the pixel cache is initialized. The pixel cache is generally not initialized when you are "pinging" an image. Let us know if that works. If so, we will consider adding a patch to initialize the pixel channel map automatically when pinging an image.
Re: imagemagick7, MagickCore: GetPixelChannels(image) not valid after PingImage()?
It works! And it makes PingBlob() work too.
Thank you very much. I have another question, I'll start a fresh topic.
Thank you very much. I have another question, I'll start a fresh topic.
Re: imagemagick7, MagickCore: GetPixelChannels(image) not valid after PingImage()?
We added a patch so you won't need to do it yourself in the next version: http://git.imagemagick.org/repos/ImageM ... 85e97aa69d
Re: imagemagick7, MagickCore: GetPixelChannels(image) not valid after PingImage()?
I've found a case when this fails. If I PingImage()/InitializePixelChannelMap(image) on a PDF I see:
image->depth = 16
GetImageType() = 6
GetPixelChannels() = 3
But if I ReadImage() the same file I see:
image->depth = 16
GetImageType() = 7
GetPixelChannels() = 4
I'd obviously like Ping and Read to return the same header so I can allocate memory correctly. Is there some way around this?
image->depth = 16
GetImageType() = 6
GetPixelChannels() = 3
But if I ReadImage() the same file I see:
image->depth = 16
GetImageType() = 7
GetPixelChannels() = 4
I'd obviously like Ping and Read to return the same header so I can allocate memory correctly. Is there some way around this?
Re: imagemagick7, MagickCore: GetPixelChannels(image) not valid after PingImage()?
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
Re: imagemagick7, MagickCore: GetPixelChannels(image) not valid after PingImage()?
Works well here. Thank you very much!