Search found 8 matches
- 2018-11-12T19:18:37-07:00
- Forum: Users
- Topic: Can't convert image file using a bash script
- Replies: 20
- Views: 30664
Re: Can't convert image file using a bash script
How did you create the shell script file? If you used Windows tools, line-ends are probably marked with carriage-return and line-feed, but bash normally expects just line-feed, and you need to tell it to ignore carriage-return. See IM with Cygwin: Line ends for workarounds.
This solved it ...
- 2018-11-12T18:15:21-07:00
- Forum: Users
- Topic: Can't convert image file using a bash script
- Replies: 20
- Views: 30664
Re: Can't convert image file using a bash script
No change.fmw42 wrote: 2018-11-12T17:31:22-07:00 Try using var and $var rather than VAR and $VAR. Perhaps your Unix thinks all cap variables are environment variables or bash reserved variables. Does that make a difference?
- 2018-11-12T17:25:49-07:00
- Forum: Users
- Topic: Can't convert image file using a bash script
- Replies: 20
- Views: 30664
Re: Can't convert image file using a bash script
That version should be fine.
Does the script always fail, or only with certain inputs? What does "echo $VAR" say?
If I run the script, it fails every time. I've tried a few different images and color numbers, but I always get the same error. If I run "echo $VAR" afterwards, it shows as blank ...
- 2018-11-12T14:25:11-07:00
- Forum: Users
- Topic: Can't convert image file using a bash script
- Replies: 20
- Views: 30664
Re: Can't convert image file using a bash script
Version: ImageMagick 6.9.10-11 Q16 x86_64 2018-09-08
So maybe my version not being up to date is causing it?
- 2018-11-12T13:55:48-07:00
- Forum: Users
- Topic: Can't convert image file using a bash script
- Replies: 20
- Views: 30664
Re: Can't convert image file using a bash script
I'm not sure which version I have, it just came bundled with cygwin. Is there a way I can check?
- 2018-11-12T04:51:59-07:00
- Forum: Users
- Topic: Can't convert image file using a bash script
- Replies: 20
- Views: 30664
Re: Can't convert image file using a bash script
That is odd. Normally, one would put quotes about the hex value xc:'#XXXXXX'. But I think that is not necessary when in the string variable you craated ($VAR), since it worked fine for me. An alternate for xc: is canvas:
To get the name of the image for prefixing the output, you can create a new ...
- 2018-11-11T21:01:47-07:00
- Forum: Users
- Topic: Can't convert image file using a bash script
- Replies: 20
- Views: 30664
Re: Can't convert image file using a bash script
The ${1::-4} was just to produce an output filename that was the same as the input filename but with "palette" tagged on to the end. It's not that important to the overall thing, but I get the same error when I remove it.
The $1 and $2 argument values are the filename of the image whose palette I'm ...
The $1 and $2 argument values are the filename of the image whose palette I'm ...
- 2018-11-11T18:58:30-07:00
- Forum: Users
- Topic: Can't convert image file using a bash script
- Replies: 20
- Views: 30664
Can't convert image file using a bash script
I'm trying to make a .sh file for use in cygwin to automate something I find myself doing a lot. The file, test.sh, contains the following:
#!/bin/bash
VAR=$(convert $1 -colors $2 -depth 8 -format "%c" histogram:info: | sort -r -k 1 | head -n 16 | grep -o -E "\#.{0,6}" | sed "s/#/xc:#/g" | sed ':a ...
#!/bin/bash
VAR=$(convert $1 -colors $2 -depth 8 -format "%c" histogram:info: | sort -r -k 1 | head -n 16 | grep -o -E "\#.{0,6}" | sed "s/#/xc:#/g" | sed ':a ...