Skip to content
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

Fixed: related x_resolution, y_resolution #102

Merged
merged 2 commits into from Aug 16, 2014
Merged

Fixed: related x_resolution, y_resolution #102

merged 2 commits into from Aug 16, 2014

Conversation

u338steven
Copy link
Contributor

Fixed: test_density(Image_Attributes_UT) in Image_attributes.rb fails #76
Fixed: test_x_resolution(Image_Attributes_UT) in Image_attributes.rb fails #81
Fixed: test_y_resolution(Image_Attributes_UT) in Image_attributes.rb fails #82

From ImageMagick 6.7.9-0:

Initialize image->x_resolution and y_resolution to 0 in image.c (previously they were initialized to DefaultResolution, which is 72.0).

ImageMagick: Changelog

  Fixed: test_density(Image_Attributes_UT) in Image_attributes.rb fails #76
  Fixed: test_x_resolution(Image_Attributes_UT) in Image_attributes.rb fails #81
  Fixed: test_y_resolution(Image_Attributes_UT) in Image_attributes.rb fails #82
@u338steven
Copy link
Contributor Author

I'm sorry, I made a mistake...
This request is bad..

@ioquatix
Copy link
Contributor

Okay, I'll wait for it to be fixed.

@ioquatix
Copy link
Contributor

We should also get a travis test for 6.8 running so we can verify these fixes.

@u338steven
Copy link
Contributor Author

Fixed
Added conditional branch about ImageMagick version

@ioquatix
Copy link
Contributor

I understand what you've done here, but is this really a good fix?

1/ Some versions might have 10 or some other revision. Recommend to use Gem::Version if possible, e.g. Gem::Version.new("6.7.9") < Gem::Version.new("6.7.10")

2/ Additionally, how are we to expect user code to deal with this change? Should we set a reasonable default value rather than depending on ImageMagick? What was the motivation of the change?

@u338steven
Copy link
Contributor Author

1/ Yeah, I think that would be better. I'll fix it to use Gem::Version.

2/ In order to distinguish an image resolution is defined or not.
I think it is necessary because some user needed.
(However, I can understand your concerns. hmm...)

A resolution of 0 means the resolution is not defined. This is a result of a bug fix where a user needed to be able to distinguish between an image whose resolution is defined @ 72DPI and those whose resolution is not defined.

ImageMagick • View topic - identify returns no resolution for TIFF generated by apple g

@ioquatix
Copy link
Contributor

2/ I think we can only do what the library does. If they decided to return 0 by default, we should do that. But, it is unexpected for users, perhaps the code was working previously with this default (e.g. generating an image), but now the resolution won't be set implicitly.

It concerns me, because I can think of cases where it isn't backwards compatible. But we don't really have much choice here. In that case, what do you think about removing the test for the default value and just testing if we can assign to it and get back the assigned value?

Another possibly useful test would be to load a set of test images and verify that the correct resolution is set. But, this really should be something that is tested as part of ImageMagick - keep in mind RMagick is just a bridge...

But ultimately, we should try not to break existing code..

@u338steven
Copy link
Contributor Author

In that case, what do you think about removing the test for the default value and just testing if we can assign to it and get back the assigned value?

That sounds good.
I think the test for the default value is not so important.
But, we might have to improve RMagick to show some warning if an image resolution is not defined.

@ioquatix
Copy link
Contributor

Showing a warning could be great, i.e. when you save the image (or convert to binary blob), perhaps.

@ioquatix
Copy link
Contributor

Let's fix this test and add the warning to the to do list somewhere :)

@u338steven
Copy link
Contributor Author

Okay, I'll create a new issue for that.

ioquatix added a commit that referenced this pull request Aug 16, 2014
Fixed: related x_resolution, y_resolution
@ioquatix ioquatix merged commit 7e695ac into rmagick:master Aug 16, 2014
@ioquatix
Copy link
Contributor

Awesome! Thanks for creating a new issue.

@u338steven u338steven deleted the patch-6 branch August 17, 2014 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants