Page 1 of 2

Found a very useful feature on bpgenc.

Posted: 2016-09-11T07:19:32-07:00
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?

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T12:21:35-07:00
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.

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T18:28:25-07:00
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

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T20:08:05-07:00
by fmw42
change

Code: Select all

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

Code: Select all

<policy domain="path" rights="read" pattern="@*" />

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T20:18:11-07:00
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.

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:18:20-07:00
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

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:23:21-07:00
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"

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:24:30-07:00
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.

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:25:19-07:00
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.

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:27:26-07:00
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.

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:34:10-07:00
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

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:36:20-07:00
by pikashi
Anyway, thank you very much.

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:37:04-07:00
by snibgo
What are the contents of the file delay.txt? (If the file is long, just the first few lines.)

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:38:46-07:00
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

Re: Found a very useful feature on bpgenc.

Posted: 2016-09-11T21:46:07-07:00
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?