Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal,... gamma?

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

henrywho wrote:Does "Extra" refer to some additional parameters?
"Extra" refers to the fact that these are not recommended methods (by me), and consequently that the extra plots are not going to go in "The Recommendations".
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

@Henry:
Sorry. I did not make clear that the "extras" are schemes I don't expect to do well, but showed for the sake of completeness. (And because, sometimes, I'm wrong.)
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

I don't like the USM look (and the kind of moire it introduces). I'm starting to think that if we want lots of sharpness, we should just do EWA with Box-windowed Jinc (no windowing), maybe slightly de-blurred.
Unacceptable when enlarging, but maybe not when downsampling a lot a DSLR photograph.
P.S. I need to sort this out a bit better. Ringing, of course, becomes a major issue.
P.S. 2 The above "raw Jinc" idea is probably wrong.
Last edited by NicolasRobidoux on 2012-10-08T08:40:43-07:00, edited 1 time in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

@Henry:
I agree that -unsharp 0x0.75+0.75+0.008 (before -colorspace sRGB, as you indicate) improves on EWA QuadraticJinc. (This is "USM_b".)
I find "USM_a" over the top.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by henrywho »

NicolasRobidoux wrote:@Henry:
I agree that -unsharp 0x0.75+0.75+0.008 (before -colorspace sRGB, as you indicate) improves on EWA QuadraticJinc. (This is "USM_b".)
I find "USM_a" over the top.
I wanna create a sample output but the labels and crops seem not matching. Is the syntax correct?

Code: Select all

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

convert backpack.jpg -crop 709x541+6021+4144 +repage -set colorspace sRGB -colorspace RGB ^
 ^( -clone 0 -filter Catrom   -distort resize %RESIZE% -set caption "E/Catrom"   ^) ^
 ^( -clone 0 -filter Lagrange -distort resize %RESIZE% -set caption "E/Lagrange" ^) ^
 ^( -clone 0 -define filter:filter=Jinc -define filter:window=Jinc -define filter:lobes=2 -define filter:blur=0.8 -distort resize %RESIZE% -set caption "E/Lanczos2ES" ^) ^
 ^( -clone 0 -define filter:filter=Jinc -define filter:window=Jinc -define filter:lobes=3 -define filter:blur=0.8 -distort resize %RESIZE% -set caption "E/Lanczos3ES" ^) ^
 ^( -clone 0 -define filter:filter=Jinc -define filter:window=Jinc -define filter:lobes=4 -define filter:blur=0.8 -distort resize %RESIZE% -set caption "E/Lanczos4ES" ^) ^
 ^( -clone 0 -filter Triangle -resize         %RESIZE% -set caption "O/Triangle" ^) ^
 ^( -clone 0 -filter Triangle -distort resize %RESIZE% -set caption "E/Triangle" ^) ^
 ^( -clone 0 -filter Robidoux -distort resize %RESIZE% -set caption "E/Robidoux" ^) ^
 ^( -clone 0 -define filter:window=Quadratic -define filter:lobes=3 -distort resize %RESIZE% -set caption "E/QuadraticJinc" ^) ^
 ^( -clone 0 -define filter:window=Spline    -define filter:lobes=3 -distort resize %RESIZE% -set caption "E/SplineJinc"    ^) ^
 ^( -clone 0 -filter Triangle -resize         %RESIZE% %DOUSM% -set caption "O/Triangle/U" ^) ^
 ^( -clone 0 -filter Triangle -distort resize %RESIZE% %DOUSM% -set caption "E/Triangle/U" ^) ^
 ^( -clone 0 -filter Robidoux -distort resize %RESIZE% %DOUSM% -set caption "E/Robidoux/U" ^) ^
 ^( -clone 0 -define filter:window=Quadratic -define filter:lobes=3 -distort resize %RESIZE% %DOUSM% -set caption "E/QuadraticJinc/U" ^) ^
 ^( -clone 0 -define filter:window=Spline    -define filter:lobes=3 -distort resize %RESIZE% %DOUSM% -set caption "E/SplineJinc/U"    ^) ^
 -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.png
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

@Henry:
Sorry, I'm busy as hell.
Here is the current state of one of my scripts. Hopefully it's useful? The "+delete" commands are very important, otherwise -define settings bleed from one command to the next.

Code: Select all

#/bin/sh
#
# Script from Nicolas Robidoux
#
# Produces the file nicolas_reduced_linear.png
#
# Comparison of various recommended filters reducing the small rings
# image through linear RGB 
#
# WARNING: Use the HDRI version of convert (otherwise tensor Lanczos
# et al are affected), namely "hdri convert".
#
hdri convert rings_sm_orig.gif  -colorspace RGB           \
  \(                                                      \
    -clone 0  -set label 'Cosine'                         \
    -filter Cosine  -resize 101x                          \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'Lanczos'                        \
    -filter Lanczos  -resize 101x                         \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'Ginseng'                        \
    -define filter:window=Jinc -define filter:lobes=3     \
    -resize 101x                                          \
    +define filter:window +define filter:lobes            \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'EWA Lanczos3Sharpest'           \
    -filter Lanczos -define filter:blur=.88549061701764   \
    -distort Resize 101x                                  \
    +define filter:blur                                   \
  \)                                                      \
  \(                                                      \
    -clone 0 -set label 'EWA LanczosRadius3'              \
    -filter Lanczos -define filter:blur=.9264075766146068 \
    -distort Resize 101x                                  \
    +define filter:blur                                   \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'EWA LanczosSharp'               \
    -filter Lanczos -define filter:blur=.9891028367558475 \
    -distort Resize 101x                                  \
    +define filter:blur                                   \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'EWA RobidouxSharp'              \
    -filter RobidouxSharp  -distort Resize 101x           \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'EWA QuadraticJinc'              \
    -define filter:window=Quadratic                       \
    -distort Resize 101x                                  \
    +define filter:window                                 \
  \)                                                      \
  \(                                                      \
    -clone 0 -set label 'Mitchell'                        \
    -filter Mitchell  -resize 101x                        \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'EWA Robidoux'                   \
    -filter Robidoux  -distort Resize 101x                \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'EWA Triangle'                   \
    -filter Triangle  -distort Resize 101x                \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'Triangle'                       \
    -filter Triangle  -resize 101x                        \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'EWA Quadratic'                  \
    -filter Quadratic  -distort Resize 101x               \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'Quadratic'                      \
    -filter Quadratic  -resize 101x                       \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'EWA Spline'                     \
    -filter Spline  -distort Resize 101x                  \
  \)                                                      \
  \(                                                      \
    -clone 0  -set label 'Spline'                         \
    -filter Spline  -resize 101x                          \
  \)                                                      \
  -delete 0                                               \
  -colorspace sRGB                                        \
  miff:-                                                  \
| \
montage -                                \
  -geometry '130x130>+3+1'               \
  -tile x4                               \
  -background LightSteelBlue             \
  -fill black                            \
  -title 'Downsizing through linear RGB' \
  -depth 8                               \
  -define png:color-type=2               \
  -quality 90                            \
  nicolas_reduced_linear.png
It's *n*x shell, which you need to translate to Windowese.
-----
Will try to cath up in the next few days.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

Of course "hdri convert" does not run unless you have installed multiple versions of IM the way Anthony does it (this script was going to his website). Just skip the "hdri" prefix otherwise.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by henrywho »

The command does give me a PNG with those crops. It's just weird seeing moire in the "crops" while there are not in the full version.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

Post Reply