Page 1 of 3

error with autotone under cygwin unable to open pixel cache

Posted: 2016-05-01T05:22:01-07:00
by dncpax
Hi there.

Wondering if anyone could help with running Fred's autotone script under cygwin.

Followed instructions, and keep getting an error of "unable to open pixel cache".

The session looks like this:

dncap@dncapStation /cygdrive/d/temp/ortos/cygwinteste
$ autotone Product97.tif Product97_v2.tif
convert.exe: unable to open pixel cache `./AUTOTONE.4444/tmpRGB.mpc': No such file or directory @ error/cache.c/OpenPixelCache/3711.
convert.exe: unable to persist pixel cache `./AUTOTONE.4444/tmpRGB.mpc' @ error/mpc.c/ReadMPCImage/944.
convert.exe: no images defined `./AUTOTONE.4444/tmpT.mpc' @ error/convert.c/ConvertImageCommand/3230.


I tried debugging by adding "set -x" at the top of the script. This gave me all the commands the script uses.
The error occurs on this command:
$ convert './AUTOTONE.9396/tmpRGB.mpc[0]' ./AUTOTONE.9396/tmpM.mpc -compose multiply -composite ./AUTOTONE.9396/tmpT.mpc

It complains that tmpRGB.mpc does not exist...

The previous command works and is like this:
$ convert ./AUTOTONE.9396/tmpRGB.mpc ./AUTOTONE.9396/tmpM.mpc -compose multiply -composite ./AUTOTONE.9396/tmpT.mpc

So my reasoning is that this command does something to tmpRGB.mpc that will error out in the following command.

At the bottom I'm pasting the output of the script with all commands sequence and error message.

Hoping someone can help.

Cheers,
Duarte

Code: Select all

$ autotone Product151.tif Product151_v2.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 /cygdrive/d/temp/ortos/cygwinteste/autotone
++ awk '{print $3}'
+ PROGNAME=/cygdrive/d/temp/ortos/cygwinteste/autotone
++ dirname /cygdrive/d/temp/ortos/cygwinteste/autotone
+ PROGDIR=/cygdrive/d/temp/ortos/cygwinteste
++ basename /cygdrive/d/temp/ortos/cygwinteste/autotone
+ PROGNAME=autotone
+ '[' 2 -eq 0 ']'
+ '[' 2 -gt 25 ']'
+ '[' 2 -gt 0 ']'
+ case "$1" in
+ break
+ infile=Product151.tif
+ outfile=Product151_v2.tif
+ '[' Product151.tif = '' ']'
+ '[' Product151_v2.tif = '' ']'
+ tmpdir=.
+ dir=./AUTOTONE.8608
+ mkdir ./AUTOTONE.8608
+ trap 'rm -rf ./AUTOTONE.8608;' 0
+ trap 'rm -rf ./AUTOTONE.8608; exit 1' 1 2 3 15
+ trap 'rm -rf ./AUTOTONE.8608; exit 1' ERR
+ '[' '' '!=' '' ']'
+ resizing=
+ convert -quiet Product151.tif +repage ./AUTOTONE.8608/tmpI.mpc
++ convert ./AUTOTONE.8608/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=06090107
+ '[' 06090107 -lt 06070607 -o 06090107 -gt 06070707 ']'
+ setcspace='-set colorspace RGB'
+ '[' 06090107 -lt 06070607 ']'
+ cspace=sRGB
+ '[' 06090107 -gt 06080504 ']'
+ setcspace=
+ cspace=sRGB
+ '[' 06090107 -lt 06060100 ']'
+ process=-color-matrix
+ '[' yes = yes ']'
+ false
+ '[' 06090107 -lt 06050501 ']'
+ convert ./AUTOTONE.8608/tmpI.mpc -auto-level ./AUTOTONE.8608/tmpI.mpc
+ '[' yes = yes ']'
+ false
+ convert ./AUTOTONE.8608/tmpI.mpc -resize 25% -channel RGB -separate ./AUTOTONE.8608/tmpRGB.mpc
+ convert ./AUTOTONE.8608/tmpI.mpc -resize 25% '(' -clone 0 -colorspace HSB -channel G -negate -separate +channel ')' '(' -clone 0 -colorspace HSB -channel B -separate +channel -solarize 50% -level 0x50% ')' '(' -clone 1 -clone 2 -compose multiply -composite ')' '(' -clone 3 -contrast-stretch 0,1% -fill black +opaque white ')' -delete 0-3 ./AUTOTONE.8608/tmpM.mpc
+ getMean ./AUTOTONE.8608/tmpM.mpc
+ img=./AUTOTONE.8608/tmpM.mpc
+ '[' 06090107 -ge 06030901 ']'
++ convert ./AUTOTONE.8608/tmpM.mpc -format '%[mean]' info:
+ mean=655.476
++ convert xc: -format '%[fx:655.476/quantumrange]' info:
+ mean=0.0100019
+ maskmean=0.0100019
+ convert ./AUTOTONE.8608/tmpRGB.mpc ./AUTOTONE.8608/tmpM.mpc -compose multiply -composite ./AUTOTONE.8608/tmpT.mpc
+ convert './AUTOTONE.8608/tmpRGB.mpc[0]' ./AUTOTONE.8608/tmpM.mpc -compose multiply -composite ./AUTOTONE.8608/tmpT.mpc
convert.exe: unable to open pixel cache `./AUTOTONE.8608/tmpRGB.mpc': No such file or directory @ error/cache.c/OpenPixelCache/3711.
convert.exe: unable to persist pixel cache `./AUTOTONE.8608/tmpRGB.mpc' @ error/mpc.c/ReadMPCImage/944.
convert.exe: no images defined `./AUTOTONE.8608/tmpT.mpc' @ error/convert.c/ConvertImageCommand/3230.
++ rm -rf ./AUTOTONE.8608
++ exit 1
+ rm -rf ./AUTOTONE.8608

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

Posted: 2016-05-01T05:45:46-07:00
by snibgo
You should say what version of IM you are using.

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

Posted: 2016-05-01T05:50:46-07:00
by dncpax
right:

$ convert --version
Version: ImageMagick 6.9.1--7 Q16 x64 2015-07-04 http://www.imagemagick.org

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

Posted: 2016-05-01T06:06:37-07:00
by snibgo
I suggest you comment-out the lines:

Code: Select all

trap "rm -rf $dir;" 0
trap "rm -rf $dir; exit 1" 1 2 3 15
trap "rm -rf $dir; exit 1" ERR
Then you can run the script, and "identify -verbose ./AUTOTONE.XXXX/tmpRGB.mpc"

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

Posted: 2016-05-01T06:54:33-07:00
by dncpax
ok. here it is:

Code: Select all

$ identify -verbose ./AUTOTONE.9396/tmpRGB.mpc
identify.exe: unable to open pixel cache `./AUTOTONE.9396/tmpRGB.mpc': No such file or directory @ error/cache.c/OpenPixelCache/3711.
identify.exe: unable to persist pixel cache `./AUTOTONE.9396/tmpRGB.mpc' @ error/mpc.c/ReadMPCImage/944.

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

Posted: 2016-05-01T07:27:06-07:00
by snibgo
Okay, so the command that created tmpRGB.mpc may have failed. But a previous command that read tmpRGB.mpc seems to have succeeded.

I'm not a bash expert, and tracking the problem when I can't reproduce it is difficult. I can only suggest that you sprinkle the code with "identify -verbose" to track that file.

Can you put Product97.tif online? If you can't, then copy-paste the output from "identify -verbose Product97.tif".

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

Posted: 2016-05-01T07:41:11-07:00
by dncpax
sure thing:

https://edia1-my.sharepoint.com/persona ... c241d67e3a

It's compressed with ycbcr jpeg.

Thanks for your help on this.

Just for context: I'm trying to get better color for a series of aerials in a gis program...

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

Posted: 2016-05-01T07:53:43-07:00
by snibgo
Product97.tif looks fine, with ordinary JPEG compression. But it is large: 100 M pixels. Are you running out of disk space? You need about 1 GB.

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

Posted: 2016-05-01T08:15:13-07:00
by dncpax
I think not. I have 48gb free on this disk, and 25bg free on c.

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

Posted: 2016-05-01T08:15:31-07:00
by dncpax
can you run autotone on it successfully?

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

Posted: 2016-05-01T08:30:53-07:00
by snibgo
Yes, no problem. It takes about a minute. While it is running, I can see the temporary files:

Code: Select all

f:\web\im>dir /od autotone.5804
 Volume in drive F is New Volume
 Volume Serial Number is F8C5-053E

 Directory of f:\web\im\autotone.5804

01/05/2016  16:25       800,000,000 tmpI.cache
01/05/2016  16:25       150,007,936 tmpRGB.cache
01/05/2016  16:25        50,000,000 tmpM.cache
01/05/2016  16:25    <DIR>          ..
01/05/2016  16:25    <DIR>          .
01/05/2016  16:25        50,000,000 tmpT.cache
01/05/2016  16:25             1,338 tmpRGB.mpc
01/05/2016  16:26               503 tmpT.mpc
01/05/2016  16:26               503 tmpM.mpc
01/05/2016  16:27               506 tmpI.mpc
               8 File(s)  1,050,010,786 bytes
               2 Dir(s)  77,048,283,136 bytes free
In particular, I can see that each .mpc file has a corresponding .cache file.

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

Posted: 2016-05-01T08:38:18-07:00
by dncpax
that's strange... maybe it's IM's version... otherwise I'm stumped...

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

Posted: 2016-05-01T08:50:19-07:00
by snibgo
If I comment-out the trap commands, after the process has finished, the files are still there, so I can:

Code: Select all

f:\web\im>identify autotone.4716\tmpRGB.mpc

autotone.4716\tmpRGB.mpc[0] MPC 2500x2500 2500x2500+0+0 8-bit Gray 1.34KB 0.016u
 0:00.002
autotone.4716\tmpRGB.mpc[1] MPC 2500x2500 2500x2500+0+0 8-bit Gray 1.34KB 0.016u
 0:00.002
autotone.4716\tmpRGB.mpc[2] MPC 2500x2500 2500x2500+0+0 8-bit Gray 1.34KB 0.016u
 0:00.003
I expect that would fail for you. But why? Is the .cache file there? Is its size correct?

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

Posted: 2016-05-01T10:55:07-07:00
by fmw42
Perhaps running out of /tmp space? Have you tried running it on a smaller image and perhaps a different input format, such as png or tif? Do you have up to date delegates especially for libjpeg. What was your exact command line? Does your install of Cygwin have all the needed unix tools? Can you run any other of my scripts, perhaps a simple one such as 2colorthresh?

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

Posted: 2016-05-01T11:31:15-07:00
by dncpax
I listed the commands that autotone creates, and executed manually each one. This is what happens. The last command uses a syntax I don't recognize: './AUTOTONE.8608/tmpRGB.mpc[0]'...

Code: Select all

mkdir AUTOTONE.8608
convert -quiet Product151.tif +repage ./AUTOTONE.8608/tmpI.mpc
convert Product151.tif +repage ./AUTOTONE.8608/tmpI.mpc
convert ./AUTOTONE.8608/tmpI.mpc -auto-level ./AUTOTONE.8608/tmpI.mpc
convert ./AUTOTONE.8608/tmpI.mpc -resize 25% -channel RGB -separate ./AUTOTONE.8608/tmpRGB.mpc
convert ./AUTOTONE.8608/tmpI.mpc -resize 25% '(' -clone 0 -colorspace HSB -channel G -negate -separate +channel ')' '(' -clone 0 -colorspace HSB -channel B-separate +channel -solarize 50% -level 0x50% ')' '(' -clone 1 -clone 2 -compose multiply -composite ')' '(' -clone 3 -contrast-stretch 0,1% -fill black +opaque white ')' -delete 0-3 ./AUTOTONE.8608/tmpM.mpc
convert ./AUTOTONE.8608/tmpRGB.mpc ./AUTOTONE.8608/tmpM.mpc -compose multiply -composite ./AUTOTONE.8608/tmpT.mpc
convert './AUTOTONE.8608/tmpRGB.mpc[0]' ./AUTOTONE.8608/tmpM.mpc -compose multiply -composite ./AUTOTONE.8608/tmpT.mpc
convert.exe: unable to open pixel cache `./AUTOTONE.8608/tmpRGB.mpc': No such file or directory @ error/cache.c/OpenPixelCache/3711.
convert.exe: unable to persist pixel cache `./AUTOTONE.8608/tmpRGB.mpc' @ error/mpc.c/ReadMPCImage/944.
convert.exe: no images defined `./AUTOTONE.8608/tmpT.mpc' @ error/convert.c/ConvertImageCommand/3230.
The contents of folder AUTOTONE.8608:

Code: Select all

-rwxrwx---+ 1 dncap None 763M May  1 19:13 tmpI.cache
-rwxrwx---+ 1 dncap None  507 May  1 19:14 tmpI.mpc
-rwxrwx---+ 1 dncap None  48M May  1 19:16 tmpM.cache
-rwxrwx---+ 1 dncap None  503 May  1 19:16 tmpM.mpc
-rwxrwx---+ 1 dncap None 1.4K May  1 19:14 tmpRGB.mpc
-rwxrwx---+ 1 dncap None  48M May  1 19:16 tmpT.cache
-rwxrwx---+ 1 dncap None  503 May  1 19:16 tmpT.mpc
I'm going to try with a smaller image. As for tmp space I don't see any disk that doesn't have more than 10gb 20gb free. Up to date delegates I don't know what they are - how can I check if they are up to date?