error with autotone under cygwin unable to open pixel cache

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: error with autotone under cygwin unable to open pixel cache

Post by fmw42 »

I suspect you are running out of tmp space. Check your tmp directory or change it to some other place that has more disk space. See your policy.xml file for temporary-path.

Code: Select all

convert -list resource
should list your policy.xml data.

For example on my system:

cat /usr/local/etc/ImageMagick-6/policy.xml

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="cache" name="shared-secret" value="passphrase"/>
</policymap>
dncpax
Posts: 29
Joined: 2016-04-30T17:32:06-07:00
Authentication code: 1151

Re: error with autotone under cygwin unable to open pixel cache

Post by dncpax »

Hi Fred.

Tried the new script with same results, using a small image:

Code: Select all

$ identify ./Product151Clip.tif
./Product151Clip.tif TIFF 2034x1224 2034x1224+0+0 8-bit sRGB 847KB 0.000u 0:00.003
Same thing.

Note that it works in a Lubuntu VM with a small disk.

I suspect something is going on with IM under win x67 (2 machines give this error - one is win10 the other win7), maybe some software combo. Both win machines have some software in common like gdal and arcgis. I can offer to debug somehow your script step by step if you give directions.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: error with autotone under cygwin unable to open pixel cache

Post by fmw42 »

User snibgo said he ran it on Cygwin with no errors. Perhaps you should discuss your Cygwin environment with him and compare it to his. See viewtopic.php?f=26&t=25910&start=30#p113836 and http://im.snibgo.com/cygwin.htm.

All I can suggest is to find out where the tmpRGB.cache file disappears in the code. What is the last command that ran and after what command did it disappear. Monitor your temp directory to see if it is getting too large.

Try one of my test images. Does that fail?

Did you check your policy configuration? Try changing the temporary-path to some place you know has lots of space.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: error with autotone under cygwin unable to open pixel cache

Post by fmw42 »

Line 157 of the script is putting all the tmp files in dir=".". That means where ever you are running the script. If you comment out lines 354-356

trap "rm -rf $dir;" 0
trap "rm -rf $dir; exit 1" 1 2 3 15
trap "rm -rf $dir; exit 1" ERR

The dir="$tmpdir/AUTOTONE.$$" will not get deleted at the end. You might be able to watch the directory (open it) while the script is running to confirm that tmpRGB.cache exists at some point and disappears later.

We need to find out why it is getting removed.
dncpax
Posts: 29
Joined: 2016-04-30T17:32:06-07:00
Authentication code: 1151

Re: error with autotone under cygwin unable to open pixel cache

Post by dncpax »

ok, so I got to run autotone and keep an eye on tmpRGB.cache desapearing act... I added 'read -p "Press [Enter] key to continue..."' to a bunch of places so I could see it.

The tmpRGB.cache is deleted when we reach the last pause in the following output. It seems to me it happens on "convert './AUTOTONE.6768/tmpRGB.mpc[1]' ./AUTOTONE.6768/tmpM.mpc -compose multiply -composite ./AUTOTONE.6768/tmpT.mpc"...

Code: Select all

$ ./autotone -G -n -s -p ../orig/Product97.tif Product97autotone.tif
+ resize=
+ bright=yes
+ gray=yes
+ white=yes
+ gamma=yes
+ noise=yes
+ sharpen=yes
+ progress=false
+ percent=1
+ gammamid=0.425
+ skythresh=80
+ skyheight=25
+ maskthresh=0.125
+ repeats=
+ gain=0.75
+ feedback=1
+ whitenorm=none
+ graynorm=none
+ dir=.
++ type ./autotone
++ awk '{print $3}'
+ PROGNAME=./autotone
++ dirname ./autotone
+ PROGDIR=.
++ basename ./autotone
+ PROGNAME=autotone
+ '[' 6 -eq 0 ']'
+ '[' 6 -gt 25 ']'
+ '[' 6 -gt 0 ']'
+ case "$1" in
+ gamma=no
+ shift
+ '[' 5 -gt 0 ']'
+ case "$1" in
+ noise=no
+ shift
+ '[' 4 -gt 0 ']'
+ case "$1" in
+ sharpen=no
+ shift
+ '[' 3 -gt 0 ']'
+ case "$1" in
+ progress=true
+ shift
+ '[' 2 -gt 0 ']'
+ case "$1" in
+ break
+ infile=../orig/Product97.tif
+ outfile=Product97autotone.tif
+ '[' ../orig/Product97.tif = '' ']'
+ '[' Product97autotone.tif = '' ']'
+ tmpdir=.
+ dir=./AUTOTONE.6768
+ mkdir ./AUTOTONE.6768
+ rem trap 'rm -rf ./AUTOTONE.6768;' 0
./autotone: line 356: rem: command not found
+ rem trap 'rm -rf ./AUTOTONE.6768; exit 1' 1 2 3 15
./autotone: line 357: rem: command not found
+ rem trap 'rm -rf ./AUTOTONE.6768; exit 1' ERR
./autotone: line 358: rem: command not found
+ '[' '' '!=' '' ']'
+ resizing=
+ convert -quiet ../orig/Product97.tif +repage ./AUTOTONE.6768/tmpI.mpc
++ convert ./AUTOTONE.6768/tmpI.mpc -format '%[fx:max(w,h)]' info:
+ dim=10000
+ '[' 10000 -gt 1000 ']'
+ reducing='-resize 25%'
++ convert -list configure
++ sed '/^LIB_VERSION_NUMBER /!d;  s//,/;  s/,/,0/g;  s/,0*\([0-9][0-9]\)/\1/g'
++ head -n 1
+ im_version=07000100
+ '[' 07000100 -lt 06070607 -o 07000100 -gt 06070707 ']'
+ setcspace='-set colorspace RGB'
+ '[' 07000100 -lt 06070607 ']'
+ cspace=sRGB
+ '[' 07000100 -gt 06080504 ']'
+ setcspace=
+ cspace=sRGB
+ '[' 07000100 -lt 06060100 ']'
+ process=-color-matrix
+ '[' yes = yes ']'
+ true
+ echo brighten
brighten
+ '[' 07000100 -lt 06050501 ']'
+ convert ./AUTOTONE.6768/tmpI.mpc -auto-level ./AUTOTONE.6768/tmpI.mpc
+ '[' yes = yes ']'
+ true
+ echo graybalance
graybalance
+ convert ./AUTOTONE.6768/tmpI.mpc -resize 25% -channel RGB -separate ./AUTOTONE
.6768/tmpRGB.mpc
+ convert ./AUTOTONE.6768/tmpI.mpc -resize 25% '(' -clone 0 -colorspace HSB -cha
nnel G -negate -separate +channel ')' '(' -clone 0 -colorspace HSB -channel B -s
eparate +channel -solarize 50% -level 0x50% ')' '(' -clone 1 -clone 2 -compose m
ultiply -composite ')' '(' -clone 3 -contrast-stretch 0,1% -fill black +opaque w
hite ')' -delete 0-3 ./AUTOTONE.6768/tmpM.mpc
+ getMean ./AUTOTONE.6768/tmpM.mpc
+ img=./AUTOTONE.6768/tmpM.mpc
+ '[' 07000100 -ge 06030901 ']'
++ convert ./AUTOTONE.6768/tmpM.mpc -format '%[mean]' info:
+ mean=3.02295
++ convert xc: -format '%[fx:3.02295/quantumrange]' info:
+ mean=0.0118547
+ maskmean=0.0118547
+ convert './AUTOTONE.6768/tmpRGB.mpc[0]' ./AUTOTONE.6768/tmpM.mpc -compose mult
iply -composite ./AUTOTONE.6768/tmpT.mpc
+ getRatio './AUTOTONE.6768/tmpT.mpc[0]' 0.5
+ getMean './AUTOTONE.6768/tmpT.mpc[0]'
+ img='./AUTOTONE.6768/tmpT.mpc[0]'
+ '[' 07000100 -ge 06030901 ']'
++ convert './AUTOTONE.6768/tmpT.mpc[0]' -format '%[mean]' info:
+ mean=1.4613
++ convert xc: -format '%[fx:1.4613/quantumrange]' info:
+ mean=0.00573059
+ ref=0.5
++ convert xc: -format '%[fx:0.00573059/0.0118547]' info:
+ ave=0.483402
+ '[' 0.483402 = 0 -o 0.483402 = 0.0 ']'
++ convert xc: -format '%[fx:0.5/0.483402]' info:
+ ratio=1.03434
+ redave=0.483402
+ redratio=1.03434
+ read -p 'Press [Enter] key to continue...'
Press [Enter] key to continue...
+ convert './AUTOTONE.6768/tmpRGB.mpc[1]' ./AUTOTONE.6768/tmpM.mpc -compose mult
iply -composite ./AUTOTONE.6768/tmpT.mpc
+ getRatio './AUTOTONE.6768/tmpT.mpc[1]' 0.5
+ getMean './AUTOTONE.6768/tmpT.mpc[1]'
+ img='./AUTOTONE.6768/tmpT.mpc[1]'
+ '[' 07000100 -ge 06030901 ']'
++ convert './AUTOTONE.6768/tmpT.mpc[1]' -format '%[mean]' info:
+ mean=1.45975
++ convert xc: -format '%[fx:1.45975/quantumrange]' info:
+ mean=0.00572451
+ ref=0.5
++ convert xc: -format '%[fx:0.00572451/0.0118547]' info:
+ ave=0.482889
+ '[' 0.482889 = 0 -o 0.482889 = 0.0 ']'
++ convert xc: -format '%[fx:0.5/0.482889]' info:
+ ratio=1.03543
+ greenave=0.482889
+ greenratio=1.03543
+ read -p 'Press [Enter] key to continue...'
Press [Enter] key to continue...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: error with autotone under cygwin unable to open pixel cache

Post by fmw42 »

Unfortunately, I still have no idea why it would do that in your Cygwin environment and does not do so in snibgo's Cygwin environment.
dncpax
Posts: 29
Joined: 2016-04-30T17:32:06-07:00
Authentication code: 1151

Re: error with autotone under cygwin unable to open pixel cache

Post by dncpax »

it's ok really. I can run that one script in a vm. The other scripts run fine.
Post Reply