0

I am facing this strange issue where i am trying to read the blob of WebP Image through MagickReadImageBlob and in the next line i just try to fetch the same blob using MagickGetImageBlob . So, my final blob size reduces strangely. So, can anyone explain this behaviour?

I am using Version: ImageMagick 6.9.8-10 Q16 x86_64 on ubuntu 16.04

Naresh
  • 5,073
  • 12
  • 67
  • 124

1 Answers1

1

So, can anyone explain this behaviour?

The MagickReadImageBlob decodes an image-file buffer into a raster of authenticated pixels.

The MagickGetImageBlob encodes the raster back into an image-file buffer.

WebP format can be either lossy, or lossless, as well as implement different compression techniques during the encoding process. It's more than possible that the encoding routine simply found another way to store the raster than the previous one. Your version of ImageMagick has a quantum depth of 16 (Q16), so the decoding/scaling of WebP's 24-bit Color + 8-bit alpha to Q16 might influence some encoding variations. Try setting MagickSetImageDepth(wand, 8) to see if that helps.

emcconville
  • 23,800
  • 4
  • 50
  • 66