Forums > Digital Art and Retouching > Downsampling with ImageMagick

Retoucher

Pictus

Posts: 1379

Teresópolis, Rio de Janeiro, Brazil

Download and install ImageMagick:
http://www.imagemagick.org/script/binar … hp#windows
http://www.imagemagick.org/script/binar … php#macosx
http://www.imagemagick.org/script/binar … s.php#unix

Download and unpack into your DeskTop
http://dl.dropbox.com/u/4686872/Pictus-resize2.zip
or http://www.mediafire.com/file/w47dqrjrz … esize2.zip
It contains some BAT files
https://i605.photobucket.com/albums/tt136/Pictus171/WEB%20stuff/desk.jpg

To resize, just drag and drop any image over one of the icons in the DeskTop

The result is better than the other programs as it is free from moiré and gamma corrected during resize.
https://i605.photobucket.com/albums/tt136/Pictus171/WEB%20stuff/PSBIvsIM.gif
The original image http://www.mediafire.com/?49ahiwm5ukfu6c9

More details:
ImageMagick resize http://www.imagemagick.org/Usage/resize/
ImageMagick and USM http://redskiesatnight.com/2005/04/06/s … ge-magick/
Resize and gamma http://www.4p8.com/eric.brasseur/gamma.html
The BAT files are versions from http://www.openphotographyforums.com/fo … hp?t=14947

-----------------------

New version!
http://dl.dropbox.com/u/4686872/Pictus_resize_D.zip

-4 batch files, 640, 800, 1024 and 1200
-Each file will create 2 versions from 3 algorithms, making 6 for you to choose. smile
-It is from a soft to sharper in gamma 1 and sRGB, all in EWA(Elliptically Weighted Average)
-You can edit the batch files to enable the orthogonal versions or the other algorithms, or disable the unneeded...


-----------------------

*** Update ***

The latest/greatest  BAT is being developed in
http://www.luminous-landscape.com/forum … ic=91754.0

Jan 09 12 09:46 pm Link

Photographer

Photons 2 Pixels Images

Posts: 17011

Berwick, Pennsylvania, US

And if you are handy with scripting in Photoshop, you can integrate ImageMagick into your Photoshop workflow through automation using scripts. smile

Bonus.

Jan 10 12 03:01 pm Link

Retoucher

Pictus

Posts: 1379

Teresópolis, Rio de Janeiro, Brazil

Good idea, but I am not good with script stuff...

Jan 10 12 04:41 pm Link

Retoucher

Pictus

Posts: 1379

Teresópolis, Rio de Janeiro, Brazil

Update smile

Jan 11 12 08:14 am Link

Retoucher

George Thomson

Posts: 699

Concord, California, US

very interesting
especially about the gamma issue.

too bad it's not available as a library for flash

Jan 12 12 08:25 am Link

Retoucher

Pictus

Posts: 1379

Teresópolis, Rio de Janeiro, Brazil

And some script as Photons 2 Pixels Images suggested ?

Jan 12 12 09:39 am Link

Retoucher

George Thomson

Posts: 699

Concord, California, US

Pictus wrote:
And some script as Photons 2 Pixels Images suggested ?

the script will be strictly on PS side, so nothing needs porting on IM side

deploying it as a "plugin" with integrated IM is a whole different thing

it will probably remain possible only to those who are savvy with computers
... unless the plugin is written in C+ with the IM libraries (which are supplied)

Jan 12 12 11:36 am Link

Retoucher

George Thomson

Posts: 699

Concord, California, US

btw, the result you got when it comes to moire is quite good
(I couldn't get it that smooth) but keep an eye on changes coming from the USM,
like the wall of the house, it almost looks like it changes colour after the Lanc+USM

Jan 13 12 07:19 am Link

Retoucher

Pictus

Posts: 1379

Teresópolis, Rio de Janeiro, Brazil

Thanks, I had the same thought as you, but by looking at the original the reason becomes clear.
It is not the USM, but the gamma.
Between the bricks the cement is white, so we got a kind of  halftone effect...
http://en.wikipedia.org/wiki/Halftone
Here the proof, get some distance from the monitor and defocus your vision, which version is right ? smile
https://i605.photobucket.com/albums/tt136/Pictus171/WEB%20stuff/GammaC.jpg

Jan 13 12 09:10 am Link

Photographer

NothingIsRealButTheGirl

Posts: 35726

Los Angeles, California, US

https://jfrancis.smugmug.com/photos/i-r6Mhd7N/0/O/i-r6Mhd7N.jpg

Filter > Blur > Average

on the image as I found it. Seems like the upper one to me.

Jan 13 12 09:31 am Link

Retoucher

Pictus

Posts: 1379

Teresópolis, Rio de Janeiro, Brazil

It is the gamma factor playing tricks again smile
Here the luminosity channel from a gamma 1 blur average.
https://i605.photobucket.com/albums/tt136/Pictus171/WEB%20stuff/Gamma-blur.jpg
The whole gamma factor is here http://www.4p8.com/eric.brasseur/gamma.html

Guys, we have to investigate the gamma factor for the “high pass sucks”...
I bet the gamma is the sucker...

Jan 13 12 10:03 am Link

Retoucher

George Thomson

Posts: 699

Concord, California, US

Pictus wrote:
It is the gamma factor playing tricks again smile
Here the luminosity channel from a gamma 1 blur average.
https://i605.photobucket.com/albums/tt136/Pictus171/WEB%20stuff/Gamma-blur.jpg
The whole gamma factor is here http://www.4p8.com/eric.brasseur/gamma.html

Guys, we have to investigate the gamma factor for the “high pass sucks”...
I bet the gamma is the sucker...

I'm still not sure about the added value of the "gamma factor". The example they give fails the resampling as designed, but if you adjust the values in the example to linear gamma, it will fail in exactly the same way using the gamma correction, and will give good results if you do it without. ... I hope you get my drift.

the perceived luminosity aside, the "off" feeling I get is that the wall looks more mortar and almost no bricks after the sharpening (which is clearly not the case in the original)

about the gamma and freq separation... it will be hard to work with, but if you add a corrective gamma curve as adjustment layer on top, it may work

Jan 13 12 10:32 am Link

Retoucher

Pictus

Posts: 1379

Teresópolis, Rio de Janeiro, Brazil

Point taken, but the are 2 different things, one is what looks better and another is what is more realistic.

BTW, Blur-aware downsample algorithm
http://www.cs.ubc.ca/~heidrich/Papers/EG.11.pdf

Jan 13 12 11:16 am Link

Retoucher

George Thomson

Posts: 699

Concord, California, US

Pictus wrote:
Point taken, but the are 2 different things, one is what looks better and another is what is more realistic.

BTW, Blur-aware downsample algorithm
http://www.cs.ubc.ca/~heidrich/Papers/EG.11.pdf

reality is subjective wink


interesting, thanks for the link

Jan 13 12 01:13 pm Link

Photographer

Sean Baker Photo

Posts: 8044

San Antonio, Texas, US

NothingIsRealButTheGirl wrote:
https://jfrancis.smugmug.com/photos/i-r6Mhd7N/0/O/i-r6Mhd7N.jpg

Filter > Blur > Average

on the image as I found it. Seems like the upper one to me.

This is actually a mathematical quirk.  Because you're doing the averaging in a 2.2 gamma space, the upper agrees.  Converting the image to linear sRGB first and then performing the same action has the opposite effect - the lower becomes 'correct'.

That said, more interesting to me is that when one moves to LAB (a gamma-independent system) and performs the same test, the top one is once again the more consistent with the original image when averaged.

As to gamma + frequency separation, leveraging gamma shifts in performing FS can have certain advantages depending on whether one is attempting to enhance local contrast (as in the original gamma argument's USM tests), or whether one is using FS for corrective purposes.  Generally the latter is going to be more intuitive in a higher gamma (1.8 or 2.2) whereas the former might be used for the sake of aesthetics (depending on one's POV and interpretation of the LAB results above).

And all that said, I do completely agree that Lanczos is and has been sorely missing form PS's repertoire.


... and sorry for the late entry into this.

Jan 29 12 06:32 am Link

Retoucher

Pictus

Posts: 1379

Teresópolis, Rio de Janeiro, Brazil

Thanks, any comment is more than welcome.

I have being seeing good results especially for model hair and fabrics with linear gamma.

Jan 29 12 11:28 am Link

Retoucher

Pictus

Posts: 1379

Teresópolis, Rio de Janeiro, Brazil

New version!
http://dl.dropbox.com/u/4686872/Pictus_resize_D.zip

-4 batch files, 640, 800, 1024 and 1200
-Each file will create 2 versions from 3 algorithms, making 6 for you to choose. smile
-It is from a soft to sharper in gamma 1 and sRGB, all in EWA(Elliptically Weighted Average)
-You can edit the batch files to enable the orthogonal versions or the other algorithms, or disable the unneeded...

Aug 01 12 02:44 pm Link

Photographer

NothingIsRealButTheGirl

Posts: 35726

Los Angeles, California, US

Sean Baker Photo wrote:
This is actually a mathematical quirk.  Because you're doing the averaging in a 2.2 gamma space, the upper agrees.  Converting the image to linear sRGB first and then performing the same action has the opposite effect - the lower becomes 'correct'.

I just tried Edit > Color Settings > Blend RGB Values Using Gamma 1.0 to see if it would change anything.

It didn't seem to affect the way the Average was calculated.

Aug 01 12 10:01 pm Link