delegate failed for BPG

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dem123456789
Posts: 12
Joined: 2018-11-07T18:19:39-07:00
Authentication code: 1152

delegate failed for BPG

Post by dem123456789 »

I try to use BPG on ImageMagick (Windows 64 ImageMagick-7.0.8-28-Q16-x64-dll.exe)
I install bpg first
I download bpg-0.9.8-win64.zip from BPG website and extract it and add to the system path. I assure I can do bpgenc on command line.
Then I install ImageMagick.
I then try command
magick tmp_0.png tmp_0.bpg

But it gives following error msg.

magick.exe: FailedToExecuteCommand `"bpgenc" -b 12 -q 4 -o "C:/Users/ADMINI~1/AppData/Local/Temp/magick-2932Mcjf2C_qT_L7" "C:/Users/ADMINI~1/AppData/Local/Temp/magick-2932v1-3ZlFNANVg"' (-1073741819) @ error/delegate.c/ExternalDelegateCommand/478.
magick.exe: delegate failed `"bpgenc" -b 12 -q %~ -o "%o" "%i"' @ error/delegate.c/InvokeDelegate/1867.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: delegate failed for BPG

Post by fmw42 »

On my Mac, IM 7.0.8.27, I can do

Code: Select all

magick logo: logo.bpg
and it works fine without installing anything.
dem123456789
Posts: 12
Joined: 2018-11-07T18:19:39-07:00
Authentication code: 1152

Re: delegate failed for BPG

Post by dem123456789 »

Actually, I have a 7.0.8.27 installed and it works fine.
Could you help me reproducing this error because I dont want to lose the 27 version installation on the other PC? I do not have 27 version installer either.
Last edited by dem123456789 on 2019-02-22T10:27:04-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: delegate failed for BPG

Post by fmw42 »

I am installing 7.0.8.28 and will try shortly.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: delegate failed for BPG

Post by fmw42 »

It works fine for me on Mac OSX Sierra with IM 7.0.8.28 Q16
dem123456789
Posts: 12
Joined: 2018-11-07T18:19:39-07:00
Authentication code: 1152

Re: delegate failed for BPG

Post by dem123456789 »

Is my installation process correct?
I cannot interpret the error msg.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: delegate failed for BPG

Post by fmw42 »

Sorry, I do not know Windows. But perhaps it is getting confused by your external install of the bpg program.
dem123456789
Posts: 12
Joined: 2018-11-07T18:19:39-07:00
Authentication code: 1152

Re: delegate failed for BPG

Post by dem123456789 »

Normally, how does IM detect if I instal bpg or not?
The bpg program is just binary files extracted from zip. If I do not add them to the system path, I dont think IM will know I install them.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: delegate failed for BPG

Post by fmw42 »

I do not know the answer to that question. But I am on a Mac and did not install those packages. So I assume ImageMagick install comes with that code already integrated.
dem123456789
Posts: 12
Joined: 2018-11-07T18:19:39-07:00
Authentication code: 1152

Re: delegate failed for BPG

Post by dem123456789 »

I find the problem is that the PNG image I try to encode with BPG cannot be encoded with 12 bit-depth.
I use bpgenc tmp.png. It works, but if I use bpgenc -b 12 tmp.png, it raise Segmentation Fault.
The delegate file acutually default BPG bit-depth to 12 and cannot be changed with -depth argument.
However bpgenc can work with bit-depth ranging from 8 to 12.

I change
<delegate decode="png" encode="bpg" command="&quot;bpgenc&quot; -b 12 -q %~ -o &quot;%o&quot; &quot;%i&quot;"/> in delegate.xml
to
<delegate decode="png" encode="bpg" command="&quot;bpgenc&quot; -b 8 -q %~ -o &quot;%o&quot; &quot;%i&quot;"/> and it then works fine.

I dont know howI can upload the image I use here. I use public data SVHN (32x32 RGB image).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: delegate failed for BPG

Post by fmw42 »

This forum does not support direct image upload. So post your image to some free hosting service (zip it if necessary) to keep it from being changed by the upload. Then put the URL here.
dem123456789
Posts: 12
Joined: 2018-11-07T18:19:39-07:00
Authentication code: 1152

Re: delegate failed for BPG

Post by dem123456789 »

I upload the image to a free hosting website.
https://ibb.co/BwxFQZ4
I think you can use bpgenc -b 12 tmp.png to reproduce the error
or use magick tmp.png tmp.bpg
If you change the line at delegate.xml from -b 12 to -b 8 or just use bpgenc tmp.png (default bit depth for bpgenc is 8. It will work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: delegate failed for BPG

Post by fmw42 »

This is an issue for the IM developers. Post your issue in the Developers forum or the Bugs forum. Put your exact command, IM version and platform and your issue with using -depth. I am confused whether the problem is with 8 or 12. But if bpgenc does not work with one of them, I suspect ImageMagick cannot either. Put a link back to this topic for reference.
dem123456789
Posts: 12
Joined: 2018-11-07T18:19:39-07:00
Authentication code: 1152

Re: delegate failed for BPG

Post by dem123456789 »

ImageMagick cannot do that either. But I think the best practice may to default to use 8 bit depth like BPG does and also enable the user to change the bit depth from 8 to maybe 12 using -depth argument.
dem123456789
Posts: 12
Joined: 2018-11-07T18:19:39-07:00
Authentication code: 1152

Re: delegate failed for BPG

Post by dem123456789 »

Post Reply