Page 1 of 1

combine two commands into one (clone)

Posted: 2016-02-19T09:03:49-07:00
by mikmach
Hello,

I have two commands which are working perfectly separately (thanks to you all!):

Code: Select all

		convert $i -quiet -profile x:\\icc\\adobeRGB.icc \
			\( +clone -gaussian-blur 6x3 \) -compose Colorize -composite j:\\hot\\$i	
		convert j:\\hot\\$i -quiet \( -clone 0 -blur 0x1.5 \) \
			\( -clone 0 -clone 1 +swap -compose mathematics -set option:compose:args "0,1,-1,0.5" -composite \) \
			\( -clone 0 -clone 2 -compose overlay -composite \) -delete 0-2 j:\\hot\\$i
First one is converting image to aRGB and does subtle denoising, second one applies high pass filter to sharpen image a bit.
I'd like to combine them into one to avoid one write to disk operation (which is costly when handling hundreds of 200MB+ files).
Unfortunately no matter how I combine them I loss one of operations, image is denoised but not sharpened or the other way around. Please, help!

Notes:
- regular sharpen filter will not cut it due to halos
- syntax oddities are due to running of regular Windows IM inside of Cygwin's zsh
- IM 6.9.3, 16-bit

m.

Re: combine two commands into one (clone)

Posted: 2016-02-19T10:03:56-07:00
by snibgo
Here are your two commands, removing paths etc:

Code: Select all

convert \
  toes.png -quiet \
  -profile AdobeRGB1998.icc \
  \( +clone -gaussian-blur 6x3 \) \
  -compose Colorize -composite \
  t2.png

convert \
  t2.png -quiet \
  \( -clone 0 -blur 0x1.5 \) \
  \( -clone 0 -clone 1 +swap -compose mathematics -set option:compose:args "0,1,-1,0.5" -composite \) \
  \( -clone 0 -clone 2 -compose overlay -composite \) \
  -delete 0-2 \
  t3.png
Removing the output filename from the first, and the input filename from the second, should work.

Code: Select all

convert \
  toes.png -quiet \
  -profile AdobeRGB1998.icc \
  \( +clone -gaussian-blur 6x3 \) \
  -compose Colorize -composite \
  \( -clone 0 -blur 0x1.5 \) \
  \( -clone 0 -clone 1 +swap -compose mathematics -set option:compose:args "0,1,-1,0.5" -composite \) \
  \( -clone 0 -clone 2 -compose overlay -composite \) \
  -delete 0-2 \
  t3b.png

compare -metric RMSE t3.png t3b.png NULL:
The "compare" shows the result is identical. What combined command did you use? Perhaps you had a typo somewhere.

(I should say I tested on bash, not zsh. I don't know how they differ.)

Re: combine two commands into one (clone)

Posted: 2016-02-22T03:32:32-07:00
by mikmach
Thank you very much! I've started to mess with parentheses and didn't go with simplest solution...