imagick
imagick copied to clipboard
Whether to make GetImageBlob() report error
- version of imageMagick:
Version: ImageMagick 7.0.9-13 Q16 x86_64 2020-01-01 https://imagemagick.org Copyright: © 1999-2020 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Delegates (built-in): bzlib fontconfig freetype jng jpeg lzma pangocairo png tiff webp wmf x xml zlib - imagick version: gopkg.in/gographics/imagick.v3 v3.3.0
i find some question when debugging.
q1, as shown in the figure, ImageMagick report error when GetImageBlob(). i think GetImageBlob() should report it.

q2, i got error convert: partition 0 overflow (> 512K) from convert and got nothing with GetImageBlob().

It is a shame that GetImageBlob and GetImagesBlob don't check for an error and return an extra error value. If we changed that now, it would be a breaking api change. So we have a few options:
- Update the documentation to recommend checking if the bytes are empty, and checking
GetLastError - Add a new variation like
GetImageBlobErr() []byte, error - Just make the breaking change, release as a new minor version, and let users update their code when it breaks
For your second question, I am not sure where that error is supposed to be generated from the ImageMagick api. If you check GetLastError immediately after the call to GetImageBlob does it produce the expected webp error? Would fixing your first question also fix the second?
I'm sorry for not recovering in time, interrupted by other things.
For q2, i think it should error in setImageFormat, but i caught error in goroutine after executing GetImageBlob(), and the main func couldn't exec in order.

I don't fully understand you last example. Why are you trying to catch the error in a tight loop in a goroutine instead of just checking GetLastError after your call to GetImageBlob? You seem to just move on to the next call.
My point was asking whether you can get the error with GetLastError right after GetImageBlob
I can't get error after GetImageBlob, func was interrupted without any result.
I don't fully understand you last example. Why are you trying to catch the error in a tight loop in a goroutine instead of just checking GetLastError after your call to GetImageBlob? You seem to just move on to the next call. My point was asking whether you can get the error with GetLastError right after GetImageBlob
If you can provide a reproduction of this error (code and source image) then I will look at improving the error handling. Otherwise this ticket might be closed.