There are two save_ functions in ImageMagick.jl which accept AbstractString and Stream.
The Stream version calls getblob and eventually calls MagickSetImageFormat, so we can use Stream(format"XXX",filename) to specify the file format regardless of file extension. The AbstractString version calls writeimage(wand, filename) directly and lets ImageMagick to infer the format.
Thus if we call save(File(format"JPEG","xxx.png"),img), we get a PNG-encoded file (which is not expected).
There are two save_ functions in ImageMagick.jl which accept
AbstractString
andStream
. TheStream
version callsgetblob
and eventually callsMagickSetImageFormat
, so we can useStream(format"XXX",filename)
to specify the file format regardless of file extension. TheAbstractString
version callswriteimage(wand, filename)
directly and lets ImageMagick to infer the format. Thus if we callsave(File(format"JPEG","xxx.png"),img)
, we get a PNG-encoded file (which is not expected).