Page 1 of 1

Question on Convert + Montage

Posted: 2012-10-12T21:31:00-07:00
by henrywho
I tried to create a thumbnail image:

Code: Select all

set DOUSM=-unsharp 0x0.75+0.75+0.008
set RESIZE=83x61! -alpha off +repage

convert wizard: -set colorspace sRGB -colorspace RGB ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -define filter:window=Quadratic -define filter:lobes=3 -distort resize %RESIZE% -set caption "E/QuadraticJinc" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 ^( -clone 0 -define filter:window=Quadratic -define filter:lobes=3 -distort resize %RESIZE% %DOUSM% -set caption "E/QuadraticJinc/U" ^) ^
 ^( -clone 0 -filter Point -resize %RESIZE% -set caption "Point" ^) ^
 -delete 0 -colorspace sRGB temp.miff
 
montage -label "%[caption]" temp.miff -geometry "120x75^>+2+2" -tile 5x ^
 -background lightgrey -fill black -title "Downsampling Test" ^
 -depth 8 -quality 95% downsamplingtest.png
But the result is obviously wrong:
Image

What's wrong with the command lines I used?

Re: Question on Convert + Montage

Posted: 2012-10-12T23:21:29-07:00
by henrywho
The result is the same if I use "temp.mpc" instead of "temp.miff".

Re: Question on Convert + Montage

Posted: 2012-10-13T10:48:13-07:00
by henrywho
In unix syntax (cygwin or msys):

Code: Select all

export DOUSM="-unsharp 0x0.75+0.75+0.008"
export RESIZE="83x61! -alpha off +repage"

./convert wizard.png -set colorspace sRGB -colorspace RGB \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -define filter:window=Quadratic -define filter:lobes=3 -distort resize ${RESIZE} -set caption "E/QuadraticJinc" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 \( -clone 0 -define filter:window=Quadratic -define filter:lobes=3 -distort resize ${RESIZE} ${DOUSM} -set caption "E/QuadraticJinc/U" \) \
 \( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
 -delete 0 -colorspace sRGB miff:- | ./montage -label "%[caption]" - -geometry "120x75>+2+2" -tile 5x \
 -background lightgrey -fill black -title "Downsampling Test" \
 -depth 8 -quality 95% downsamplingtest_miff.png

Re: Question on Convert + Montage

Posted: 2012-10-13T15:02:13-07:00
by fmw42
Hello henrywho,

What is the issue at hand?

Each of your images is the same except for two. Why not just create 3 with the appropriate label and -clone or -duplicate the others to repeat the point version, then pipe that to montange. You might also try adding -respect-parenthesis at the beginning of your convert command before the sequence of parentheses. see
http://www.imagemagick.org/Usage/basics/#controls But without understanding the problem this may just be a guess.

This works faster than your version and does show different images that are smoother for the two non-point images due to the -respect parenthesis. (I tried it with and without and there is a clear difference). My guess is that -filter point is persisting without it. So I assume that was the issue at hand? I presume this is a test for when you want each image to be a different filter. So if that is the case, then the clone parts are only relevant to this example.

DOUSM="-unsharp 0x0.75+0.75+0.008"
RESIZE="83x61! -alpha off +repage"
convert wizard: -set colorspace sRGB -colorspace RGB -respect-parenthesis \
\( -clone 0 -filter Point -resize ${RESIZE} -set caption "Point" \) \
\( -clone 1 \) \
\( -clone 1 \) \
\( -clone 1 \) \
\( -clone 1 \) \
\( -clone 1 \) \
\( -clone 1 \) \
\( -clone 1 \) \
\( -clone 0 -define filter:window=Quadratic -define filter:lobes=3 -distort resize ${RESIZE} -set caption "E/QuadraticJinc" \) \
\( -clone 1 \) \
\( -clone 1 \) \
\( -clone 1 \) \
\( -clone 1 \) \
\( -clone 0 -define filter:window=Quadratic -define filter:lobes=3 -distort resize ${RESIZE} ${DOUSM} -set caption "E/QuadraticJinc/U" \) \
\( -clone 1 \) \
-delete 0 -colorspace sRGB miff:- | montage -label "%[caption]" - -geometry "120x75>+2+2" -tile 5x \
-background lightgrey -fill black -title "Downsampling Test" \
-depth 8 -quality 95 2downsamplingtest.png


Also -quality is not percent, that is no % symbol is needed. For jpg it is like percent without the % as it is in the range 0 to 100. But for png, it is measured differenly, though I am no expert on that. So see
http://www.imagemagick.org/script/comma ... hp#quality
http://www.imagemagick.org/Usage/formats/#png_write

Re: Question on Convert + Montage

Posted: 2012-10-13T19:16:49-07:00
by henrywho
Yeah! "-respect-parenthesis" does the magic!

But why doesn't NicolasRobidoux need this parameter when he produces his samples?

Re: Question on Convert + Montage

Posted: 2012-10-13T19:20:52-07:00
by fmw42
henrywho wrote:Yeah! "-respect-parenthesis" does the magic!

But why doesn't NicolasRobidoux need this parameter when he produces his samples?
I do not know how he does it. As he is using IM 7 magick command rather than IM 6 convert, then perhaps there is a difference or fix in IM 7.