New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downscale (with FILTER_CUBIC) looks worse in 7.0.5-4 than in 6.9.4-0 #520

Closed
Trost123 opened this Issue Jun 23, 2017 · 17 comments

Comments

Projects
None yet
3 participants
@Trost123

Trost123 commented Jun 23, 2017

UPD: We figured out that it's not a sharpen problem, but downscale problem: #520 (comment)

Original post:
Hi. I have 2 servers, one runs with ImageMagick 6.9.4, other got 7.0.5.
For some reason, sharpen looks way worse in 7.0.5:
Blurry dress patterns and flowers
This is how this image looks in 6.9.4:
Sharp and good looking

My actions are:

$image = new Imagick('testimg.JPG');
$image->resizeImage(467, 700, Imagick::FILTER_CUBIC, 0.5); 
$image->sharpenImage(0, 0.6);

Original image is 647x970.
Original, just in case

Also, if I crank up the second parameter, the image will change on 7.0.5, so sharpenImage() works, but it jumps from blurry to messy in 0.6-1.1 range real quick.

Any idea to why this happens or how to fix it? (I'd hate having to roll-back to 6.9.4)

@fmw42

This comment has been minimized.

Show comment
Hide comment
@fmw42

fmw42 Jun 23, 2017

I have tested your image in command line mode using the latest IM 6.9.8.10 Q16 (non-hdri) and IM 7.0.6.0 Q16 hydri with the following commands and see no significant differences.

IM 6
convert testing.JPG -filter cubic -define filter:b=0.5 -resize 467x700 -sharpen 0x0.6 tmpb6.jpg

IM 6 result

IM 7
magick testing.JPG -filter cubic -define filter:b=0.5 -resize 467x700 -sharpen 0x0.6 tmpb7.jpg

IM 7 result

compare -metric rmse tmpb6.jpg tmpb7.jpg null:
64.0422 (0.000977222)

You have not identified the full versions of ImageMagick, so I could not test with those exact versions. Perhaps this is an issue with your ImageMagick versions or with Imagick using ImageMagick 7.

fmw42 commented Jun 23, 2017

I have tested your image in command line mode using the latest IM 6.9.8.10 Q16 (non-hdri) and IM 7.0.6.0 Q16 hydri with the following commands and see no significant differences.

IM 6
convert testing.JPG -filter cubic -define filter:b=0.5 -resize 467x700 -sharpen 0x0.6 tmpb6.jpg

IM 6 result

IM 7
magick testing.JPG -filter cubic -define filter:b=0.5 -resize 467x700 -sharpen 0x0.6 tmpb7.jpg

IM 7 result

compare -metric rmse tmpb6.jpg tmpb7.jpg null:
64.0422 (0.000977222)

You have not identified the full versions of ImageMagick, so I could not test with those exact versions. Perhaps this is an issue with your ImageMagick versions or with Imagick using ImageMagick 7.

@Trost123

This comment has been minimized.

Show comment
Hide comment
@Trost123

Trost123 Jun 23, 2017

Sorry, didn't know.
It's:
ImageMagick 6.9.4-0 Q16 x86_64 2016-05-09 http://www.imagemagick.org
vs
ImageMagick 7.0.5-4 Q16 x86_64 2017-04-12 http://www.imagemagick.org

Trost123 commented Jun 23, 2017

Sorry, didn't know.
It's:
ImageMagick 6.9.4-0 Q16 x86_64 2016-05-09 http://www.imagemagick.org
vs
ImageMagick 7.0.5-4 Q16 x86_64 2017-04-12 http://www.imagemagick.org

@Trost123

This comment has been minimized.

Show comment
Hide comment
@Trost123

Trost123 Jun 23, 2017

Also, difference can be seen better if you downscale more:
1 200
1 200 blur

Trost123 commented Jun 23, 2017

Also, difference can be seen better if you downscale more:
1 200
1 200 blur

@fmw42

This comment has been minimized.

Show comment
Hide comment
@fmw42

fmw42 Jun 23, 2017

What resizing values did you use here in these smaller ones.

fmw42 commented Jun 23, 2017

What resizing values did you use here in these smaller ones.

@Trost123

This comment has been minimized.

Show comment
Hide comment
@Trost123

Trost123 Jun 23, 2017

$image->resizeImage(133, 200, Imagick::FILTER_CUBIC, 0.5);

Trost123 commented Jun 23, 2017

$image->resizeImage(133, 200, Imagick::FILTER_CUBIC, 0.5);

@fmw42

This comment has been minimized.

Show comment
Hide comment
@fmw42

fmw42 Jun 23, 2017

I still do not find any differences using 6.9.4.0 and 7.0.5.4.
im6940
convert 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x0.6 tmpc6.jpg

IM 6 result

im7054
magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x0.6 tmpc7.jpg

IM 7 result

compare -metric rmse tmpc6.jpg tmpc7.jpg null:
79.9543 (0.00122003)

My guess is that it is in Imagick and its interface to IM 7

fmw42 commented Jun 23, 2017

I still do not find any differences using 6.9.4.0 and 7.0.5.4.
im6940
convert 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x0.6 tmpc6.jpg

IM 6 result

im7054
magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x0.6 tmpc7.jpg

IM 7 result

compare -metric rmse tmpc6.jpg tmpc7.jpg null:
79.9543 (0.00122003)

My guess is that it is in Imagick and its interface to IM 7

@Trost123

This comment has been minimized.

Show comment
Hide comment
@Trost123

Trost123 Jun 23, 2017

Hm. Why are your results 133x199 though?
And your commands have 133x300, where I mentioned 133x200 in previous post.

Regarding the quality - your examples look the same compared to each other.
Compared to my examples it's (sharpness quality):
my v.7 image > your v.6\7 image > my v.6 image

I have 4 virtual servers from same hosting provider. PHP settings show PHP version 5.6 on all of them.
2 of them report ImageMagick 6.9.4-0 Q16 x86_64, other two report 7.0.5-4 Q16 x86_64.
When I run this test on all 4 I get 2 blurry results (v7) and 2 sharp result (v6).
Note that I'm a basic user and I don't know PHP well. All of this was pre-installed. I have no idea why is ImageMagick different on these servers.
If you know what else I can log through php files to debug this, I'll do it.

My guess is that it is in Imagick and its interface to IM 7
Should I contact my hosting provider with this issue? I've no idea what this means.

Trost123 commented Jun 23, 2017

Hm. Why are your results 133x199 though?
And your commands have 133x300, where I mentioned 133x200 in previous post.

Regarding the quality - your examples look the same compared to each other.
Compared to my examples it's (sharpness quality):
my v.7 image > your v.6\7 image > my v.6 image

I have 4 virtual servers from same hosting provider. PHP settings show PHP version 5.6 on all of them.
2 of them report ImageMagick 6.9.4-0 Q16 x86_64, other two report 7.0.5-4 Q16 x86_64.
When I run this test on all 4 I get 2 blurry results (v7) and 2 sharp result (v6).
Note that I'm a basic user and I don't know PHP well. All of this was pre-installed. I have no idea why is ImageMagick different on these servers.
If you know what else I can log through php files to debug this, I'll do it.

My guess is that it is in Imagick and its interface to IM 7
Should I contact my hosting provider with this issue? I've no idea what this means.

@Trost123

This comment has been minimized.

Show comment
Hide comment
@Trost123

Trost123 Jun 23, 2017

Also, in version 7, if I change:
$image->sharpenImage(0, 0.6);
to
$image->sharpenImage(0, 2);
(just to test if sharpen does anything at all)
I get this result:
imagick_test
Which doesn't look like sharpening to me at all. More like some kind of bloom.

Trost123 commented Jun 23, 2017

Also, in version 7, if I change:
$image->sharpenImage(0, 0.6);
to
$image->sharpenImage(0, 2);
(just to test if sharpen does anything at all)
I get this result:
imagick_test
Which doesn't look like sharpening to me at all. More like some kind of bloom.

@fmw42

This comment has been minimized.

Show comment
Hide comment
@fmw42

fmw42 Jun 23, 2017

Sorry about my typo of 300 rather than 200. I have edited my post above and replaced the images. But is see no difference.

With regard to sharpen change from 0.6 to 2.0, I did this test with IM 7.0.5.4 and 7.0.6.0

im7054
magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x2 tmpc7054.jpg

im7060
magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x2 tmpc7060.jpg

compare -metric rmse tmpc7054.jpg tmpc7060.jpg null:
0 (0)

So there does not seem to be any difference between the two versions of ImageMagick 7.

Here are my images using sharpening of 0.6 and 2.0 in IM 7.0.5.4. The effects of too large a sharpening on very small images can cause some odd issues, such as apparent increased contrast. I do not know if this is what you have complained about.

magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x2 tmp7054_s2.jpg

sharpen 0x2

magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x0.6 tmp7054_s0p6.jpg

sharpen 0x0.6

I would suggest you contact the Imagick developer.

P.S. Have you tried leaving off the sharpening to be sure the issue is not with the resize and cubic filter?

fmw42 commented Jun 23, 2017

Sorry about my typo of 300 rather than 200. I have edited my post above and replaced the images. But is see no difference.

With regard to sharpen change from 0.6 to 2.0, I did this test with IM 7.0.5.4 and 7.0.6.0

im7054
magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x2 tmpc7054.jpg

im7060
magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x2 tmpc7060.jpg

compare -metric rmse tmpc7054.jpg tmpc7060.jpg null:
0 (0)

So there does not seem to be any difference between the two versions of ImageMagick 7.

Here are my images using sharpening of 0.6 and 2.0 in IM 7.0.5.4. The effects of too large a sharpening on very small images can cause some odd issues, such as apparent increased contrast. I do not know if this is what you have complained about.

magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x2 tmp7054_s2.jpg

sharpen 0x2

magick 27492314-7618021c-584e-11e7-8da4-9c0f396ec015.JPG -filter cubic -define filter:b=0.5 -resize 133x200 -sharpen 0x0.6 tmp7054_s0p6.jpg

sharpen 0x0.6

I would suggest you contact the Imagick developer.

P.S. Have you tried leaving off the sharpening to be sure the issue is not with the resize and cubic filter?

@Trost123

This comment has been minimized.

Show comment
Hide comment
@Trost123

Trost123 Jun 23, 2017

@fmw42 man, you're a genius!
Simplified my test case to:

<?php

error_reporting(E_ALL);
ini_set( 'display_errors','1');

//sending image header to proper display the image
header('Content-type: image/png');

//loading the image
$image = new Imagick('testimg.JPG');
$image->resizeImage(133, 200, Imagick::FILTER_CUBIC, 0.5);

echo $image;
?>

Result

So this is a filter problem after all? Renamed this thread accordingly.

Doesn't solve my problem yet, but brings me another step closer to solution.
So, I guess new imagick on my host is really messing up the resize\cubic filer.

P.S. I don't want to mess with my site's CMS code (which uses Imagick), so I guess I'll just reinstall version 6 on all servers and forget it.

Trost123 commented Jun 23, 2017

@fmw42 man, you're a genius!
Simplified my test case to:

<?php

error_reporting(E_ALL);
ini_set( 'display_errors','1');

//sending image header to proper display the image
header('Content-type: image/png');

//loading the image
$image = new Imagick('testimg.JPG');
$image->resizeImage(133, 200, Imagick::FILTER_CUBIC, 0.5);

echo $image;
?>

Result

So this is a filter problem after all? Renamed this thread accordingly.

Doesn't solve my problem yet, but brings me another step closer to solution.
So, I guess new imagick on my host is really messing up the resize\cubic filer.

P.S. I don't want to mess with my site's CMS code (which uses Imagick), so I guess I'll just reinstall version 6 on all servers and forget it.

@Trost123 Trost123 changed the title from Sharpen works worse in 7.0.5 than in 6.9.4 to Downscale (with FILTER_CUBIC) looks worse in 7.0.5-4 than in 6.9.4-0 Jun 23, 2017

@fmw42

This comment has been minimized.

Show comment
Hide comment
@fmw42

fmw42 Jun 23, 2017

To be honest, I did not know that Imagick even supported ImageMagick 7, yet. So perhaps if it does, it still has some bugs.

fmw42 commented Jun 23, 2017

To be honest, I did not know that Imagick even supported ImageMagick 7, yet. So perhaps if it does, it still has some bugs.

@Trost123

This comment has been minimized.

Show comment
Hide comment
@Trost123

Trost123 Jun 23, 2017

@fmw42 anyway, thanks for the help. There's no telling how long I'd struggle with this without someone cooperating. Now I can sleep peacefully. 🛌
I thought you're the developer, because of your avatar. 😄
I'll contact my hosting provider tomorrow and ask them to downgrade IM7 on those servers.

Leaving this issue open for the developer to see.

Trost123 commented Jun 23, 2017

@fmw42 anyway, thanks for the help. There's no telling how long I'd struggle with this without someone cooperating. Now I can sleep peacefully. 🛌
I thought you're the developer, because of your avatar. 😄
I'll contact my hosting provider tomorrow and ask them to downgrade IM7 on those servers.

Leaving this issue open for the developer to see.

@fmw42

This comment has been minimized.

Show comment
Hide comment
@fmw42

fmw42 Jun 23, 2017

I am not a developer, but I work with the ImageMagick developers to answer questions on their forum and prototype and test code. I script ImageMagick and have many little scripts, which you can see at http://www.fmwconcepts.com/imagemagick/index.php.

But note that the ImageMagick team did not create nor do they support Imagick. That is a separate piece of software built upon ImageMagick. You can post to the Imagick forum at http://www.imagemagick.org/discourse-server/viewforum.php?f=18&sid=0412005dc66f5785fcb2d2e8d6a13449. I may be wrong, but I think the new Imagick developer's username is danack.

fmw42 commented Jun 23, 2017

I am not a developer, but I work with the ImageMagick developers to answer questions on their forum and prototype and test code. I script ImageMagick and have many little scripts, which you can see at http://www.fmwconcepts.com/imagemagick/index.php.

But note that the ImageMagick team did not create nor do they support Imagick. That is a separate piece of software built upon ImageMagick. You can post to the Imagick forum at http://www.imagemagick.org/discourse-server/viewforum.php?f=18&sid=0412005dc66f5785fcb2d2e8d6a13449. I may be wrong, but I think the new Imagick developer's username is danack.

@Trost123

This comment has been minimized.

Show comment
Hide comment
@Trost123

Trost123 Jun 24, 2017

I was always wondering if there is difference between ImageMagick and Imagick, or it's just an short alias for it. Now you made it clear.
Thanks for the link, I'll reference this issue there.

Trost123 commented Jun 24, 2017

I was always wondering if there is difference between ImageMagick and Imagick, or it's just an short alias for it. Now you made it clear.
Thanks for the link, I'll reference this issue there.

@fmw42

This comment has been minimized.

Show comment
Hide comment

fmw42 commented Jun 24, 2017

@fmw42

This comment has been minimized.

Show comment
Hide comment

fmw42 commented Jun 24, 2017

@Trost123

This comment has been minimized.

Show comment
Hide comment
@Trost123

Trost123 Jun 26, 2017

snibgo helped me resolve this issue on the IMagick forum. 🍾

I conclude that your v7 version (or, more likely, IMagick) is respecting "-filter cubic", so you get the mushy result. Your v6 version ignores "-filter cubic" and uses the default filter, with the better result.

Trost123 commented Jun 26, 2017

snibgo helped me resolve this issue on the IMagick forum. 🍾

I conclude that your v7 version (or, more likely, IMagick) is respecting "-filter cubic", so you get the mushy result. Your v6 version ignores "-filter cubic" and uses the default filter, with the better result.

@Trost123 Trost123 closed this Jun 26, 2017

@dlemstra dlemstra added the question label Jun 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment