The quality of re-sized image is not good
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: The quality of re-sized image is not good
I'm not going to test liquid rescale because I've never used it and it's kind of "special".
-----
Here is my current recommendation for your situation, which takes into account that you probably are not obsessive w.r.t. file size.
convert input -colorspace rgb -define filter:window=quadratic -define filter:lobes=3 -distort resize widthxheight! -colorspace srgb -sampling-factor 1x1 -quality 89 output
"-sampling-factor 1x1" is ignored when output is not .jpg. -quality 89 only affects visual quality when it's a .jpg. So, you can use the same command across the board, and all you have to do is put the appropriate suffix (.jpg, .gif, .png) and you'll get what you want.
The above filter should work pretty well across the board for your images.
However, I've added "linear light colorspace" commands, because you are producing thumbnails, and when reducing the size of an image you should "always" use linear light. (Pardon my Greek, but I'm not only writing for you.) Linear light generally does not hurt enlargements.
Some rather terse explanations are found here: http://www.imagemagick.org/Usage/resize/#nicolas, the current version of "Nicolas Robidoux's Recommendations".
-----
Let me know how this works out for you.
-----
Here is my current recommendation for your situation, which takes into account that you probably are not obsessive w.r.t. file size.
convert input -colorspace rgb -define filter:window=quadratic -define filter:lobes=3 -distort resize widthxheight! -colorspace srgb -sampling-factor 1x1 -quality 89 output
"-sampling-factor 1x1" is ignored when output is not .jpg. -quality 89 only affects visual quality when it's a .jpg. So, you can use the same command across the board, and all you have to do is put the appropriate suffix (.jpg, .gif, .png) and you'll get what you want.
The above filter should work pretty well across the board for your images.
However, I've added "linear light colorspace" commands, because you are producing thumbnails, and when reducing the size of an image you should "always" use linear light. (Pardon my Greek, but I'm not only writing for you.) Linear light generally does not hurt enlargements.
Some rather terse explanations are found here: http://www.imagemagick.org/Usage/resize/#nicolas, the current version of "Nicolas Robidoux's Recommendations".
-----
Let me know how this works out for you.
Last edited by NicolasRobidoux on 2012-09-24T09:16:37-07:00, edited 2 times in total.
Re: The quality of re-sized image is not good
@NicolasRobidoux
Yes it could but would probably need "building" into his version of IM as I do not belive it is in the distributions.
As has been discussed in the past when liquid rescale ( seam carving) came out there is no way in IM to indicate the areas not to effect. In Gimp as you probably know ( coincidently I have just modified an image with it just now ) you can have a mask to indicate the areas to modify or not modify.
There was talk about automaticaly finding "high energy" areas which the assumtion was these would not be touched.
I wonder if an idea would be to "strech" in some way the area from the side of the resised image to the side of the canvas?
Yes it could but would probably need "building" into his version of IM as I do not belive it is in the distributions.
As has been discussed in the past when liquid rescale ( seam carving) came out there is no way in IM to indicate the areas not to effect. In Gimp as you probably know ( coincidently I have just modified an image with it just now ) you can have a mask to indicate the areas to modify or not modify.
There was talk about automaticaly finding "high energy" areas which the assumtion was these would not be touched.
I wonder if an idea would be to "strech" in some way the area from the side of the resised image to the side of the canvas?
Re: The quality of re-sized image is not good
To resize your images to all the different sizes it would might be a good idea to write some code be it be a script, batch file or php to loop through or write each size into the one IM command line specifing the size and output name.
The loop method would be more friendly as you could specify different option and sizes outside th IM command line which would be easier to change.
The loop method would be more friendly as you could specify different option and sizes outside th IM command line which would be easier to change.
Re: The quality of re-sized image is not good
I tried to use -liquid-rescale
See the command:
Then I got this error message:
All images generated despite the fact that the names were the expected have the same dimension of the original image.
OK, I give up. It's too much work for me.
I will study Scheme language to call Gimp.
Thank you all for the efforts.
Best regards.
See the command:
Code: Select all
convert sample.png -liquid-rescale 160x160 sample/sample-160x160.gif
Code: Select all
convert.exe: delegate library support not built-in `sample.png' (LQR) @ error/resize.c/LiquidRescaleImage/1889.
OK, I give up. It's too much work for me.
I will study Scheme language to call Gimp.
Thank you all for the efforts.
Best regards.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: The quality of re-sized image is not good
I do not believe that liquid-rescale is an option in IM for Windows. I think it is only available for Unix systems.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: The quality of re-sized image is not good
Just out of curiosity, I ran all the following tests without regard to colorspace or sigmoidization. Simply to see which was the sharpest without regard to other artifacts.
Image are at: http://www.fmwconcepts.com/misc_tests/r ... rchive.zip
convert wargame.png -filter catrom -distort resize 640x480! wargame_catrom_dresize.png
convert wargame.png -filter lagrange -distort resize 640x480! wargame_lagrange_dresize.png
convert wargame.png -filter catrom -resize 640x480! wargame_catrom_resize.png
convert wargame.png -filter lagrange -resize 640x480! wargame_lagrange_resize.png
convert wargame.png -filter LanczosSharp -distort resize 640x480! wargame_lanczossharp_dresize.png
convert wargame.png -filter Lanczos -define filter:blur=.9264075766146068 -distort resize 640x480! wargame_lanczosrad3_dresize.png
convert wargame.png -define filter:window=Jinc -define filter:lobes=3 -define filter:window=Jinc -define filter:lobes=3 -resize 640x480! wargame_ginseng3_resize.png
convert wargame.png -define filter:window=Jinc -define filter:lobes=3 -define filter:window=Jinc -define filter:lobes=3 -distort resize 640x480! wargame_ginseng3_dresize.png
The first two were clearly sharper than the rest with a very slight edge to the catrom over the lagrange (both -distort resize).
All the rest were very similar in terms of sharpness.
It is interesting that -distort resize was better than -resize in the catrom and lagrange test, though I am not sure if the -distort resize is actually sharper or has some slight increase in contrast.
Both of these were slightly sharper than what he got from GIMP. All the others were on par with what he got from GIMP.
All done on IM 6.7.9.7 Q16 Mac OSX Snow Leopard (No HDRI)
Image are at: http://www.fmwconcepts.com/misc_tests/r ... rchive.zip
convert wargame.png -filter catrom -distort resize 640x480! wargame_catrom_dresize.png
convert wargame.png -filter lagrange -distort resize 640x480! wargame_lagrange_dresize.png
convert wargame.png -filter catrom -resize 640x480! wargame_catrom_resize.png
convert wargame.png -filter lagrange -resize 640x480! wargame_lagrange_resize.png
convert wargame.png -filter LanczosSharp -distort resize 640x480! wargame_lanczossharp_dresize.png
convert wargame.png -filter Lanczos -define filter:blur=.9264075766146068 -distort resize 640x480! wargame_lanczosrad3_dresize.png
convert wargame.png -define filter:window=Jinc -define filter:lobes=3 -define filter:window=Jinc -define filter:lobes=3 -resize 640x480! wargame_ginseng3_resize.png
convert wargame.png -define filter:window=Jinc -define filter:lobes=3 -define filter:window=Jinc -define filter:lobes=3 -distort resize 640x480! wargame_ginseng3_dresize.png
The first two were clearly sharper than the rest with a very slight edge to the catrom over the lagrange (both -distort resize).
All the rest were very similar in terms of sharpness.
It is interesting that -distort resize was better than -resize in the catrom and lagrange test, though I am not sure if the -distort resize is actually sharper or has some slight increase in contrast.
Both of these were slightly sharper than what he got from GIMP. All the others were on par with what he got from GIMP.
All done on IM 6.7.9.7 Q16 Mac OSX Snow Leopard (No HDRI)
Last edited by fmw42 on 2012-09-24T10:06:11-07:00, edited 1 time in total.
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: The quality of re-sized image is not good
@Fred:
Replace 640x480! by 500% and hopefully you'll see why I don't recommend EWA CatRom and Lagrange.
Replace 640x480! by 500% and hopefully you'll see why I don't recommend EWA CatRom and Lagrange.
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: The quality of re-sized image is not good
@Fred:
This being said, I realize that they may be attractive if you want to sharpen the image.
This being said, I realize that they may be attractive if you want to sharpen the image.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: The quality of re-sized image is not good
yes it is and as it is only pixel removal and adding it can generate aliasing.NicolasRobidoux wrote:I'm not going to test liquid rescale because I've never used it and it's kind of "special".
I have always wanted to get the actual pixel removal masks and try to use it to generate displacement maps and eventually blur that
mask a little to generate area resampled versions of liquid rescaling. Sort of a filtered version of it
![Smile :-)](./images/smilies/icon_smile.gif)
But currently the LQR API library does not seem to provide any such access to these 'internals' to play with.
![Sad :-(](./images/smilies/icon_sad.gif)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: The quality of re-sized image is not good
The wargame picture is a line art and it is up-sized by a few pixels only (474 -> 480). I think linear EWA Lanczos3Sharpest does the job very well.
Code: Select all
convert wargame.png -colorspace RGB -define filter:filter=Jinc -define filter:window=Jinc -define filter:lobes=3 -define filter:blur=0.88549061701764 -distort resize 640x480 -alpha off +repage -colorspace sRGB -gravity center -extent 640x480 -quality 95% output.png
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: The quality of re-sized image is not good
When enlarging, EWALanczos3Sharpest occasionally has bad artifacts when, for example, two almost perfectly horizontal or vertical dark lines are about three pixel away from each other on a lighter background. This most likely has to do with the first crossing being too close to the center.
This is why I do not recommended it for enlarging.
Given that it has much to commend it, Lanczos3Sharpest goes to the top of my list of "schemes to tweak". And I have some ideas.
But I'm leaving this quest aside for a while.
This is why I do not recommended it for enlarging.
Given that it has much to commend it, Lanczos3Sharpest goes to the top of my list of "schemes to tweak". And I have some ideas.
But I'm leaving this quest aside for a while.
Re: The quality of re-sized image is not good
What about EWALanczos2Sharpest?NicolasRobidoux wrote:This is why I do not recommended it for enlarging.
![Surprised :o](./images/smilies/icon_surprised.gif)
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: The quality of re-sized image is not good
If you like it, I'll give it a second look. It may have slipped between the cracks. (There are lot of schemes to comparehenrywho wrote:...What about EWALanczos2Sharpest?
![Sad :(](./images/smilies/icon_sad.gif)
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: The quality of re-sized image is not good
@Henry:
When enlarging, EWA Lanczos2Sharpest is way too jaggy, and it's performance as a reconstructor is unremarkable (per Adam Turcotte's forthcoming thesis).
If you absolutely want a 2-lobe method, you're better off with a Keys cubic, RobidouxSharp, for example.
And if you want the appearance of a 2-lobe method, Quadratic-windowed Jinc 3 is much much better. Slightly softer, yes. But in my eye it's no contest.
So, "The Recommendations" stand: EWA Lanczos2Sharpest is definitely a "dead prototype" in my book. (At least for upsampling.)
When enlarging, EWA Lanczos2Sharpest is way too jaggy, and it's performance as a reconstructor is unremarkable (per Adam Turcotte's forthcoming thesis).
If you absolutely want a 2-lobe method, you're better off with a Keys cubic, RobidouxSharp, for example.
And if you want the appearance of a 2-lobe method, Quadratic-windowed Jinc 3 is much much better. Slightly softer, yes. But in my eye it's no contest.
So, "The Recommendations" stand: EWA Lanczos2Sharpest is definitely a "dead prototype" in my book. (At least for upsampling.)
Re: The quality of re-sized image is not good
I see....NicolasRobidoux wrote:So, "The Recommendations" stand: EWA Lanczos2Sharpest is definitely a "dead prototype" in my book. (At least for upsampling.)
![Shocked :shock:](./images/smilies/icon_eek.gif)