Re: RegisterStaticModules depreciated -> how to register formats now?

Bob Friesenhahn <[email protected]> Tue, 11 Feb 2020 08:19:24 -0600 (CST)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Tue, 11 Feb 2020, Pro Turm wrote:

> How about if I only need ImageInfo, and not MagickInfo ?
> 
> Why I need this? I need to BlobToImage only.

I am not sure about the point you are making or what the problem is. 
The path to reading or writing any format has always been by calling 
GetMagickInfo() to obtain the necessary information to call the coder. 
The only thing which has practically changed is the form of the code 
in magick/static.c.  Rather than there being two functions to populate 
with Register/Unregister calls (RegisterStaticModules and 
UnregisterStaticModules), now there is an array "StaticModules" which 
declares the module name and register/unregister functions.

It is indeed true that when RegisterStaticModules() existed, all of 
the module registration functions were invoked when GraphicsMagick was 
initialized and the module destruction functions were invoked before 
GraphicsMagick quit.  Now the module registration functions are only 
invoked if the module is needed and only initialized modules are 
destroyed.  This might have some impact on initialization.

> So I created the needed ImageIndo with CloneImageInfo(nullptr), filled it out, This was sufficent at the time when
> RegisterStaticModules was not depreciated.

I see that BlobToImage() calls GetMagickInfo() using the 'magick' 
format specifier, as it always has.

Something I did not mention before is that if the name of your format 
differs from the module name (e.g. the module supports multiple 
formats or you prefered to use a different module name) then an entry 
should be added in magick/module_aliases.h so that the implementation 
knows the module to open based on the format name.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt