MagickGetImageSize
Posted: 2006-12-26T16:23:34-07:00
MagickGetImageSize returns a value of MagickSizeType. My main usage of this will be in conjunction with MagickPingImage to test whether an image is of manageable size beofre actually reading it.
I am calling the MagickWand DLL from another language. I prototyped MagickGetImageSize in the calling program to receive a LONG result. That seems to work, in that I get back the correct size of the (relatively small) images I have.
However, the headers lead me to believe MagickSizeType is a 64-bit type, and that my program is seeing only the low 32 bits of that. If my program comes upon an image file with a 6GB image, I presume my program will receive the size modulo 2**32, and believe it is safe in loading it.
The language I am using has no concept of anything larger than 32 bits, so cannot handle anything larger than that in the calling interface.
It would be nice if there was a MagickWand call that returned a 64-bit image size in the form of a pointer to an array of LONG. My program could then at least test for images larger than 2**32 bytes.
I am calling the MagickWand DLL from another language. I prototyped MagickGetImageSize in the calling program to receive a LONG result. That seems to work, in that I get back the correct size of the (relatively small) images I have.
However, the headers lead me to believe MagickSizeType is a 64-bit type, and that my program is seeing only the low 32 bits of that. If my program comes upon an image file with a 6GB image, I presume my program will receive the size modulo 2**32, and believe it is safe in loading it.
The language I am using has no concept of anything larger than 32 bits, so cannot handle anything larger than that in the calling interface.
It would be nice if there was a MagickWand call that returned a 64-bit image size in the form of a pointer to an array of LONG. My program could then at least test for images larger than 2**32 bytes.