Found a very useful feature on bpgenc.

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?".
pikashi
Posts: 6
Joined: 2016-09-11T07:13:21-07:00
Authentication code: 1151

Found a very useful feature on bpgenc.

Post by pikashi »

-delayfile file
text file containing one number per image giving the display delay per image in centiseconds.
With this feature setting the frame delay of the animated images becomes very easy, can I get it on the ImageMagick convert program?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Found a very useful feature on bpgenc.

Post by fmw42 »

You can build a text file (say delay.txt) as rows of pairs of delays and images

Code: Select all

-delay 10 lena.jpg 
-delay 100 ellipse.png 
-delay 500 rose.png
If you are on an older version IM or you remove the restriction on importing files with @ as indirect reads (see your policy.xml file and read viewtopic.php?f=4&t=26801), then you can do

Code: Select all

convert @delay.txt -loop X result.gif
Otherwise on Unix, you can do

Code: Select all

convert $(cat delay.txt) -loop 0 result.gif
Please always provide your IM version and platform, since syntax and scripting may differ.
pikashi
Posts: 6
Joined: 2016-09-11T07:13:21-07:00
Authentication code: 1151

Re: Found a very useful feature on bpgenc.

Post by pikashi »

Code: Select all

<policymap>
  <!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
  <!-- <policy domain="resource" name="memory" value="2GiB"/> -->
  <!-- <policy domain="resource" name="map" value="4GiB"/> -->
  <!-- <policy domain="resource" name="width" value="10MP"/> -->
  <!-- <policy domain="resource" name="height" value="10MP"/> -->
  <!-- <policy domain="resource" name="area" value="1GB"/> -->
  <!-- <policy domain="resource" name="disk" value="16EB"/> -->
  <!-- <policy domain="resource" name="file" value="768"/> -->
  <!-- <policy domain="resource" name="thread" value="4"/> -->
  <!-- <policy domain="resource" name="throttle" value="0"/> -->
  <!-- <policy domain="resource" name="time" value="3600"/> -->
  <!-- <policy domain="system" name="precision" value="6"/> -->
  <!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
  <!-- <policy domain="delegate" rights="none" pattern="HTTPS" /> -->
  <!-- <policy domain="path" rights="none" pattern="@*" /> -->
  <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/>
</policymap>
This is my policy.xml, How should I edit it to enable indirect reads?

My IM version: ImageMagick 7.0.3-0 Q16 x64 2016-09-05
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Found a very useful feature on bpgenc.

Post by fmw42 »

change

Code: Select all

<!-- <policy domain="path" rights="none" pattern="@*" /> -->
To

Code: Select all

<policy domain="path" rights="read" pattern="@*" />
pikashi
Posts: 6
Joined: 2016-09-11T07:13:21-07:00
Authentication code: 1151

Re: Found a very useful feature on bpgenc.

Post by pikashi »

Code: Select all

>convert @delay.txt out.gif
convert: unable to open image '@delay.txt': No such file or directory @ error/blob.c/OpenBlob/2695.
convert: invalid argument for option '-delay': 0000.png @ error/convert.c/ConvertImageCommand/1286.
Modified but still not work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Found a very useful feature on bpgenc.

Post by fmw42 »

Then you have not edited the correct policy.xml file. Where is your file? See the information at http://www.imagemagick.org/script/architecture.php and order checked at http://www.imagemagick.org/script/resources.php and read http://www.imagemagick.org/source/policy.xml

I do not know if you have to reboot or not.

You did not answer my question about your Platform. So on Unix, you can find your policy.xml using

Code: Select all

find /usr | grep "policy.xml"
if you installed IM in /usr
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Found a very useful feature on bpgenc.

Post by fmw42 »

You can also try setting it to

Code: Select all

<policy domain="path" rights="read | write" pattern="@*" />
But I would have thought that all you needed was "read"
pikashi
Posts: 6
Joined: 2016-09-11T07:13:21-07:00
Authentication code: 1151

Re: Found a very useful feature on bpgenc.

Post by pikashi »

Code: Select all

D:\Program Files\ImageMagick-7.0.3-Q16\policy.xml
D:\Program Files\ImageMagick-7.0.3-Q16\www\source\policy.xml
There are only 2 policy.xml files, I edited the first one.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Found a very useful feature on bpgenc.

Post by fmw42 »

If neither work, then you will need advice from one of the Developers or someone who knows more about policy.xml than I. You can post to Bugs forum, if no one else has a solution or confirms that it does not work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Found a very useful feature on bpgenc.

Post by fmw42 »

D:\Program Files\ImageMagick-7.0.3-Q16\policy.xml

I do not know Windows. If that is the installed code and not just the download from IM, then that would be the one to edit. Try rebooting afterwards.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Found a very useful feature on bpgenc.

Post by fmw42 »

You can get around this by simply reading the file into a variable and using the variable in your command line. Sorry I do not know windows, but in unix

Code: Select all

variable=$(cat delay.txt)
magick $variable -loop N -layers optimize result.gif
pikashi
Posts: 6
Joined: 2016-09-11T07:13:21-07:00
Authentication code: 1151

Re: Found a very useful feature on bpgenc.

Post by pikashi »

Anyway, thank you very much.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Found a very useful feature on bpgenc.

Post by snibgo »

What are the contents of the file delay.txt? (If the file is long, just the first few lines.)
snibgo's IM pages: im.snibgo.com
pikashi
Posts: 6
Joined: 2016-09-11T07:13:21-07:00
Authentication code: 1151

Re: Found a very useful feature on bpgenc.

Post by pikashi »

Code: Select all

-delay 5 0000.png
-delay 5 0001.png
-delay 5 0002.png
-delay 5 0003.png
-delay 5 0004.png
-delay 5 0005.png
-delay 5 0006.png
-delay 5 0007.png
-delay 5 0008.png
-delay 5 0009.png
-delay 5 0010.png
-delay 5 0011.png
-delay 5 0012.png
-delay 5 0013.png
-delay 5 0014.png
-delay 5 0015.png
-delay 5 0016.png
-delay 5 0017.png
-delay 5 0018.png
-delay 5 0019.png
-delay 5 0020.png
-delay 5 0021.png
-delay 5 0022.png
-delay 5 0023.png
-delay 5 0024.png
-delay 5 0025.png
-delay 5 0026.png
-delay 5 0027.png
-delay 5 0028.png
-delay 5 0029.png
-delay 5 0030.png
-delay 5 0031.png
-delay 5 0032.png
-delay 5 0033.png
-delay 5 0034.png
-delay 5 0035.png
-delay 5 0036.png
-delay 5 0037.png
-delay 5 0038.png
-delay 5 0039.png
-delay 5 0040.png
-delay 5 0041.png
-delay 5 0042.png
-delay 5 0043.png
-delay 5 0044.png
-delay 5 0045.png
-delay 5 0046.png
-delay 5 0047.png
-delay 5 0048.png
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Found a very useful feature on bpgenc.

Post by snibgo »

Well, we know that IM is reading delay.txt because the error message mentions 0000.png. I can't see what is wrong. I assume 0000.png etc exist?
snibgo's IM pages: im.snibgo.com
Post Reply