Menu

#65 GraphicsMagick support for bpg please.

open
nobody
None
5
2022-06-01
2022-06-01
bat
No

Hi
I have libbpg with bpgdec decoder installed on my Linux system.
With ImageMagick it seems to use bpgdec with the delegates configuration ...

Like this...

~ $ display -verbose 003.bpg
'bpgdec' -b 16 -o '/tmp/magick-hNezXAXI6ttnT3WKWG08ZILyCG3TdjUS.png' '/tmp/magick-sViswqOUFZW_kHCiNiXVN31EFmaeKV8u'; /bin/mv '/tmp/magick-hNezXAXI6ttnT3WKWG08ZILyCG3TdjUS.png' '/tmp/magick-hNezXAXI6ttnT3WKWG08ZILyCG3TdjUS'
003.bpg PNG 1436x730 1436x730+0+0 16-bit sRGB 2.17652MiB 0.100u 0:00.090

But with GraphicsMagick it doesn't work...

Like this...

~ $ gm display -verbose 003.bpg
gm display: No decode delegate for this image format (003.bpg).
Untitled=>LOGO GIF 654x418+0+0 PseudoClass 128c 8-bit 21.6Ki 0.000u 0m:0.002669s (97.7Mi pixels/s)

I realize there isn't much demand for bpg support, but could GraphicsMagick be told to use bpgdec same as ImageMagick does?

PS
ImageMagick also uses bpgenc to write...
Like this...

~ $ convert -verbose foo.jpg foo.bpg
foo.jpg JPEG 640x427 640x427+0+0 8-bit sRGB 131199B 0.010u 0:00.024
foo.jpg=>/tmp/magick-sv7b0PUoqXJHIFegq1SV2UWXR4gpDCeQ PNG 640x427 640x427+0+0 8-bit sRGB 131199B 0.100u 0:00.100
'bpgenc' -b 12 -q '10' -o '/tmp/magick-i9ypSvCCOwqf2JCxdhYVBSarrvUIPQHt' '/tmp/magick-U4qvLQuaOiYOivHB5YtU2-xRACZv5Tt7'
foo.jpg=>foo.bpg PNG 640x427 640x427+0+0 8-bit sRGB 131199B 0.000u 0:01.138
1 Attachments

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2022-06-01

    On Wed, 1 Jun 2022, bat wrote:

    I realize there isn't much demand for bpg support, but could GraphicsMagick be told to use bpgdec same as ImageMagick does?

    I have not heard of this format before. It it is read via an external
    delegate (as ImageMagick apparently does) then support could be added
    by editing the text file 'delegates.mgk'. If this works for you, then
    please send us the tested 'delegates.mgk' additions.

    Bob

    Bob Friesenhahn
    bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
    GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
    Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt

     
    • bat

      bat - 2022-06-01

      Hi
      There is a similar document here ---> https://imagemagick.org/source/delegates.xml

      I think it's this file to be edited
      GraphicsMagick-1.4.020220529/config/delegates.mgk

      Add these two lines to delegates.mgk underneath "<delegatemap>"</delegatemap>

      <delegate decode="bpg" command=""bpgdec" -b 16 -o "%o.png" "%i"; /usr/bin/mv "%o.png" "%o""/>
      <delegate decode="png" encode="bpg" command=""bpgenc" -b 12 -o "%o" "%i""/>
      

      Then ./configure.

      But it's not working for me.

      ~ $ gm display -verbose 003.bpg
      gm display: No decode delegate for this image format (003.bpg).
      Untitled=>LOGO GIF 654x418+0+0 PseudoClass 128c 8-bit 21.6Ki 0.000u 0m:0.002626s (99.3Mi pixels/s)
      

      I've attached the modified file, maybe I did something wrong.

       
      • bat

        bat - 2022-06-01

        Here it is

         
        • Bob Friesenhahn

          Bob Friesenhahn - 2022-06-01

          On Wed, 1 Jun 2022, bat wrote:

          But with GraphicsMagick it doesn't work...

          Like this...
          ~~~
          ~ $ gm display -verbose 003.bpg
          gm display: No decode delegate for this image format (003.bpg).
          Untitled=>LOGO GIF 654x418+0+0 PseudoClass 128c 8-bit 21.6Ki 0.000u 0m:0.002669s (97.7Mi pixels/s)

          Make sure that your configuration was loaded appropriately by doing

          'gm convert -list delegates'

          If there is no line output for 'bpg' then something is wrong.

          Bob

          Bob Friesenhahn
          bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
          GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
          Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt

           
        • bat

          bat - 2022-06-01

          Hi
          In the delegates.mkg.in file there are strange entries like this...
          ~~~
          command='"@DCRAWDecodeDelegate@"
          "@BrowseDelegate@
          ~~~"

          I only want to add a line somewhere that looks similar to this from IM...
          <delegate decode="bpg" command="" bpgdec"="" -b="" 16="" -o="" "%o.png"="" "%i";="" usr="" bin="" mv="" "%o""=""></delegate>

          Is that IM line the correct format to add to GM's delegates.mkg.in file?

          Maybe you could edit a delegates.mkg.in file for me to try because I'm out of my depth here.

           
          • Bob Friesenhahn

            Bob Friesenhahn - 2022-06-02

            On Wed, 1 Jun 2022, bat wrote:

            Hi
            In the delegates.mkg.in file there are strange entries like this...
            ~~~
            command='"@DCRAWDecodeDelegate@"
            "@BrowseDelegate@
            ~~~"

            This would be the original template file. The file you would edit is
            'delegates.mgk'.

            The configure script searches for programs and does substitutions so
            that the @FOO@ value becomes the path to the program, or just the
            generic name of the program if it was not found. The end result is
            'delegates.mgk' (e.g.
            /usr/local/lib/GraphicsMagick-1.4/config/delegates.mgk)/

            I only want to add a line somewhere that looks similar to this from IM...
            <delegate decode="bpg" command="" bpgdec"="" -b="" 16="" -o="" "%o.png"="" "%i";="" usr="" bin="" mv="" "%o""=""></delegate>

            Is that IM line the correct format to add to GM's delegates.mkg.in file?

            It seems pretty close. Notice that the top of the 'delegates.mgk'
            file includes a lot of documentation.

            Maybe you could edit a delegates.mkg.in file for me to try because I'm out of my depth here.

            You have a lot of examples, and it should work if you start with the
            correct file.

            It is possible to have your own copy of the file which is located in
            other than the formally installed location. The MAGICK_CONFIGURE_PATH
            environment variable can be used to specify where to look for private
            versions of files. From the documentation:

                MAGICK_CONFIGURE_PATH
                       Search path to  use  when  searching  for  configuration
                       (.mgk) files.  The formatting of the search path is sim‐
                       ilar to operating system search paths (i.e. colon delim‐
                       ited  for  Unix,  and semi-colon delimited for Microsoft
                       Windows). This user specified search path is used before
                       trying the default search path.
            

            Bob

            Bob Friesenhahn
            bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
            GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
            Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt

             

          Log in to post a comment.

          Auth0 Logo