Page 1 of 1

delegate failed for BPG

Posted: 2019-02-22T09:53:10-07:00
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.

Re: delegate failed for BPG

Posted: 2019-02-22T10:15:15-07:00
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.

Re: delegate failed for BPG

Posted: 2019-02-22T10:24:13-07:00
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.

Re: delegate failed for BPG

Posted: 2019-02-22T10:25:53-07:00
by fmw42
I am installing 7.0.8.28 and will try shortly.

Re: delegate failed for BPG

Posted: 2019-02-22T10:27:52-07:00
by fmw42
It works fine for me on Mac OSX Sierra with IM 7.0.8.28 Q16

Re: delegate failed for BPG

Posted: 2019-02-22T10:30:11-07:00
by dem123456789
Is my installation process correct?
I cannot interpret the error msg.

Re: delegate failed for BPG

Posted: 2019-02-22T10:44:48-07:00
by fmw42
Sorry, I do not know Windows. But perhaps it is getting confused by your external install of the bpg program.

Re: delegate failed for BPG

Posted: 2019-02-22T11:13:24-07:00
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.

Re: delegate failed for BPG

Posted: 2019-02-22T11:28:01-07:00
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.

Re: delegate failed for BPG

Posted: 2019-02-23T22:12:20-07:00
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).

Re: delegate failed for BPG

Posted: 2019-02-23T22:32:21-07:00
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.

Re: delegate failed for BPG

Posted: 2019-02-24T00:27:31-07:00
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.

Re: delegate failed for BPG

Posted: 2019-02-24T12:05:20-07:00
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.

Re: delegate failed for BPG

Posted: 2019-02-24T12:54:10-07:00
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.

Re: delegate failed for BPG

Posted: 2019-02-24T15:37:53-07:00
by dem123456789