Pages: 1 2 3 [4] 5 6 ... 24   Go Down

Author Topic: A free high quality resampling tool for ImageMagick users  (Read 230653 times)

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #60 on: July 22, 2014, 06:45:51 am »

Bart:
With the lighthouse, you use gamma 2 blend, or straight through linear RGB?
P.S. Irregardless, this is a score 1 for EWA LanczosRadius.
« Last Edit: July 22, 2014, 06:47:42 am by NicolasRobidoux »
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8911
Re: A free high quality resampling tool for ImageMagick users
« Reply #61 on: July 22, 2014, 07:34:11 am »

Note that, to the best of my recollection, the lighthouse original is quite strongly sharpened.
In an ideal toolchain, you don't sharpen before downsampling.
P.S. If this is what you used to evaluate EWA LanczosSharpest 4, this pre-sharpening may have skewed the evaluation.

Hi Nicolas,

No worries. The original Lighthouse PhotoCD file (IMG0019.PCD) is not (over)sharpened (it's basically a filmscan) at its highest packed resolution (16BASE = 3072x2048 pixels). See attached crops of the original 16BASE size. You are correct that there are versions floating about the internet as 'reference images', using the middle resolution (BASE = 768x512 pixels), which are over'sharpened' with halos. I used the original's 16BASE.

The cruel but real life image I use for testing is the one I posted a link to in another thread. Here is a direct image link for this thread. I will post a down-sampled example, for those who cannot try it themselves (unfortunate non-Imagemagick users), once I've settled on which method to use.

Also a downsample of the 1000x1000px 'Rings' image (link to 16-b/ch PNG version, with AdobeRGB profile (=gamma 2.2) embedded) to 200x200 pixels, another torture test, will tell a lot about the capability to withstand the most tasking aliasing prone cases.

Cheers,
Bart
« Last Edit: July 22, 2014, 08:21:26 am by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8911
Re: A free high quality resampling tool for ImageMagick users
« Reply #62 on: July 22, 2014, 07:41:09 am »

Bart:
With the lighthouse, you use gamma 2 blend, or straight through linear RGB?
P.S. Irregardless, this is a score 1 for EWA LanczosRadius.

Straight linear gamma (EWA) -distort Resize,
-filter LanczosRadius -distort Resize %Msize%
nothing else, except for added sharpening in output gamma space
(which avoids differences between light and dark halo amplitude).

Cheers,
Bart
« Last Edit: July 22, 2014, 07:50:52 am by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #63 on: July 22, 2014, 07:46:22 am »

Ok, thank you.
If I read http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=25945&p=113584#p113553 correctly, Adobe RGB is a "straight" gamma space (without a linear segment: the power law is used wall to wall), which means that going to some linear RGB is as easy as applying gamma. (See Section 4.3.1.2 of the linked tech report.) Then, the Adobe RGB to linear and linear to gamma 2 (say) conversions can be merged into one single gamma, which can be undone at once. This should improve the acccuracy in a 16 bit toolchain. The "merged gamma" should be
2./2.19921875
P.S. Also, instead of using gamma 2, one could simply blend the Adobe RGB result "as is" with the linear light result. The difference between 2 and 2.19921875 is not great, so why introduce truncation errors? We've found that both gamma 2 and 3 work OK, so there is no reason why gamma 2.19921875 should not work just fine.
« Last Edit: July 22, 2014, 08:02:54 am by NicolasRobidoux »
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8911
Re: A free high quality resampling tool for ImageMagick users
« Reply #64 on: July 22, 2014, 07:48:53 am »

If you add final sharpening, I would be very tempted to use the now "standard" EWA LanczosSharp, overcoming the softness with post-sharpening.
It's amazingly good at anti-aliasing.

I'll give it a try. Initial results look interesting, slightly different from LanczosRadius, both are nice.

I'll try it with my 'Rings' image and see what happens. Edit: See P.S.!

Cheers,
Bart

P.S. The verdict is in, LanczosSharp looks slightly cleaner and has an overall higher resolution (see logarithmic FFT attachment, amplitude is higher for LanczosSharp, and slightly less ragged). It really required this FFT analysis to spot the differences, so we are fitting a few more angels on a pinhead.
« Last Edit: July 22, 2014, 09:00:46 am by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #65 on: July 22, 2014, 08:00:21 am »

I'll give it a try. Initial results look interesting, slightly different from LanczosRadius, both are nice.

I'll try it with my 'Rings' image abd see what happens.

Cheers,
Bart
EWA Lanczos should also work fine, especially if you shove your output into JPEG.
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8911
Re: A free high quality resampling tool for ImageMagick users
« Reply #66 on: July 22, 2014, 08:04:38 am »

If I read http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=25945&p=113584#p113553 correctly, Adobe RGB is a "straight" gamma space, which means that going to some linear RGB is as easy as applying gamma. (See Section 4.3.1.2 of the linked tech report.) Then, the Adobe RGB to linear and linear to gamma 2 (say) conversions can be merged into one single gamma, which can be undone at once. This should improve the acccuracy in a 16 bit toolchain. The "merged gamma" should be
2./2.19921875

Correct, the AdobeRGB 1998 profile is 'straight' gamma 2.2 (EDIT: actually 1/2.2, or precompensated gamma 2.2).

Accuracy in the nth significant digit may indeed be improved fractionally, provided one always uses Adobe RGB, but precision will probably be good enough for normal use anyway. A simple to code generic sRGB -> RGB -> sRGB roundtrip will not really be an issue even though the shadows will be a tad lighter (if I'm not mistaken, need to check) in linearized light space (which may even help avoid some clipping).

Cheers,
Bart
« Last Edit: July 22, 2014, 08:30:07 am by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #67 on: July 22, 2014, 08:08:50 am »

It makes sense to me to use 2.19921875 as "standard gamma" in which case we already have it when using Adobe RGB, and we only need to undo it to move things through linear RGB.
In the case of sRGB, the toolchain remains as before, except for the value of gamma.
P.S. I really don't like the "linear segment" of sRGB: Fine for compressing, not fine for manipulating the image.
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8911
Re: A free high quality resampling tool for ImageMagick users
« Reply #68 on: July 22, 2014, 08:28:49 am »

It makes sense to me to use 2.19921875 as "standard gamma" in which case we already have it when using Adobe RGB, and we only need to undo it to move things through linear RGB.
In the case of sRGB, the toolchain remains as before, except for the value of gamma.
P.S. I really don't like the "linear segment" of sRGB: Fine for compressing, not fine for manipulating the image.

I'm not sure, but it may have to do with the popular use of the term 'gamma'. AdobeRGB is actually gamma 1/2.2 (precompensating for the display gamma of 2.2). So it would require a gamma 2.2 to linearize, and a gamma 0.45454545454... to restore.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8911
Re: A free high quality resampling tool for ImageMagick users
« Reply #69 on: July 22, 2014, 09:26:12 am »

P.S. I really don't like the "linear segment" of sRGB: Fine for compressing, not fine for manipulating the image.

I also wondered about why that was a 'default' colorspace in ImageMagick (maybe the answer can be found on their forums). From a scientific viewpoint a straightforward gamma 2.2 / 0.454545 pair would seem easier to analyze than one with a straight line segment in the shadows ...

However, ImageMagick is flexible enough to use any real ICC Profile conversion we would like, or even a synthetic 'Custom' one created in Photoshop.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #70 on: July 22, 2014, 10:19:51 am »

...
P.S. The verdict is in, LanczosSharp looks slightly cleaner and has an overall higher resolution (see logarithmic FFT attachment, amplitude is higher for LanczosSharp, and slightly less ragged). It really required this FFT analysis to spot the differences, so we are fitting a few more angels on a pinhead.
Would you be kind enough to add EWA Lanczos's plot?
P.S. Note: The rings image is very smooth. I believe that with sharp natural images, the difference between, say, LanczosRadius and LanczosSharp (and Lanczos) are more pronounced.
« Last Edit: July 22, 2014, 11:10:38 am by NicolasRobidoux »
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8911
Re: A free high quality resampling tool for ImageMagick users
« Reply #71 on: July 22, 2014, 12:44:05 pm »

Would you be kind enough to add EWA Lanczos's plot?

See attachments, a comparison between LanczosSharp and Lanczos filters, both used with -distort Resize in Linear gamma. The attached images are zoomed in (NearestNeighbor) to see the details. The LanczosSharp FFT amplitude is higher suggesting better signal, but otherwise they look rather similar.

Quote
P.S. Note: The rings image is very smooth. I believe that with sharp natural images, the difference between, say, LanczosRadius and LanczosSharp (and Lanczos) are more pronounced.

We'll see, based on the other torture test image of the ship's rigging.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #72 on: July 22, 2014, 12:49:25 pm »

Bart:

Thank you.

Score 1 for LanczosSharp.
Logged

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #73 on: July 22, 2014, 12:50:32 pm »

...
No worries. The original Lighthouse PhotoCD file (IMG0019.PCD) is not (over)sharpened (it's basically a filmscan) at its highest packed resolution (16BASE = 3072x2048 pixels).
...
Indeed, this version is clean.
Logged

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #74 on: July 22, 2014, 01:08:33 pm »

...To show a bit more of what it's about, I've attached a sample of the down-sampling quality as it is right now. I've used the well known Lighthouse image from the PhotoCD sampler CD, and reduced the full resolution to 25%, with sharpening (make sure you watch it at real 100% zoom resolution, by downloading it). Aliasing is very well controlled, fully automatic...
It looks really good, although it has too much haloing, dark esp., for my taste.
However, I dislike haloing more than many.
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8911
Re: A free high quality resampling tool for ImageMagick users
« Reply #75 on: July 22, 2014, 02:03:56 pm »

It looks really good, although it has too much haloing, dark esp., for my taste.
However, I dislike haloing more than many.

I agree the sharpening is still a bit heavy handed, I have yet to calculate a more exact Point Spread Function after down-sampling (PSF). Now that the methods seem to be decided (for the moment), I'll work a bit more on the sharpening characteristics (maybe offer a couple of options, mild/normal/strong) so that one doesn't have to edit the script for certain types of images.

To recap the (current) method choices:
  • For general resizing, but especially upsampling: a blend between a gamma 1 and a gamma 1+2 resampling with the LanczosDetail LanczosRadius filter.
  • For down-sampling without sharpening: a gamma 1 resampling with the Lanczos4Sharper Lanczos4Sharpest filter recipe.
  • For down-sampling with sharpening: a gamma 1 resampling with the LanczosSharp filter.

Cheers,

P.S. Descriptions were adjusted
« Last Edit: July 22, 2014, 06:17:12 pm by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

Pictus

  • Full Member
  • ***
  • Offline Offline
  • Posts: 216
    • Retouching
Re: A free high quality resampling tool for ImageMagick users
« Reply #76 on: July 22, 2014, 02:07:16 pm »

Indeed, however, if one allows the ImageMagick installer to do it (see third attachment), that is already taken care of as it prefixes the new Path to Imagemagick to the existing startup file. The drawback of using that option is that new installations will keep prefixing new paths to the PATH environment variable, so one needs to occasionally edit the older locations out (always tricky, so don't make mistakes).

That is why I prefer to install ImageMagick to a directory without the version number, here is
always at c:\Program Files\ImageMagick\ so the path stays the same in all the upgrades.

BTW, for a sharper downsampling without sharpening, EWA Catrom is interesting...
Not "perfect", but usable most of the times.
Logged

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #77 on: July 22, 2014, 02:09:15 pm »

Pictus: My opinion is that EWA RobidouxSharp is generally better than EWA CatRom in the "hit me over the head with a baseball bat but hold the second halo" sharpness department.
« Last Edit: July 22, 2014, 02:11:04 pm by NicolasRobidoux »
Logged

NicolasRobidoux

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 280
Re: A free high quality resampling tool for ImageMagick users
« Reply #78 on: July 22, 2014, 02:11:48 pm »

To recap the (current) method choices:
  • For general resizing, but especially upsampling: a blend between a gamma 1 and a gamma 1+2 resampling with the LanczosDetail filter.
  • For down-sampling without sharpening: a gamma 1 resampling with the Lanczos4Sharper filter recipe.
  • For down-sampling with sharpening: a gamma 1 resampling with the LanczosSharp filter.
Bart: I don't really understand the first two list items.
Logged

Pictus

  • Full Member
  • ***
  • Offline Offline
  • Posts: 216
    • Retouching
Re: A free high quality resampling tool for ImageMagick users
« Reply #79 on: July 22, 2014, 02:38:26 pm »

(...)"hit me over the head with a baseball bat but hold the second halo"(...)

LoL!!!!!!!!!

BTW, I was unable to find ImageMagick 7 Win x64 binaries.
Logged
Pages: 1 2 3 [4] 5 6 ... 24   Go Up