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

fix(artwork rail): change image resize mode to "cover" #11021

Merged
merged 1 commit into from
Oct 26, 2024

Conversation

anandaroop
Copy link
Member

@anandaroop anandaroop commented Oct 25, 2024

This PR resolves this QA launch-blocking bug:
https://www.notion.so/artsy/Border-around-artwork-rail-images-12acab0764a080e298c1d1ca455895c9

Description

Before After

QA uncovered an issue where some images appear to have hairline rules visible on their borders.

(See ⬆️ in the Before column the sides of the first image and the top/bottom of the second image.)

The hairline itself, if you really zoom in there, turns out to be the blurhash showing through because it is not completely covered by the final image! Notice the gradient from the pale green down to the dark blue here:



The root cause appears to be tiny sub-pixel differences between the calculated size of the image component and the actual image source file itself.

For example in the "before" image above, the calculated size is 215 x 215 but the image source file is 1100 x 1104

When resized in contain mode, the image is shrunk to 214.2 x 215, which leaves a little strip visible on either side.

Furthermore this difference is really apparent when the artwork image (contrary to our guidelines!) has a white buffer around it, as these images do (see original).

This QA caught a perfect storm of multiple such images which made the problem very visible.

Solution

If we instead resize this in cover mode, the image is scaled down just enough to completely cover the 215 x 215 container, and therefore leaves none of the background blurhash showing through. This fix comes at the expense of "throwing away" a minuscule 1-pixel or so line of image data, which is more acceptable than the alternative imo.

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

  • Fix hairline image issue on artwork rail images

iOS user-facing changes

Android user-facing changes

Dev changes

Need help with something? Have a look at our docs, or get in touch with us.

@anandaroop anandaroop assigned anandaroop and dariakoko and unassigned anandaroop Oct 25, 2024
@anandaroop anandaroop requested review from dariakoko, MounirDhahri and a team October 25, 2024 22:00
@anandaroop anandaroop marked this pull request as ready for review October 25, 2024 22:00
@ArtsyOpenSource
Copy link
Contributor

This PR contains the following changes:

  • Cross-platform user-facing changes (Fix hairline image issue on artwork rail images - roop - anandaroop)

Generated by 🚫 dangerJS against 67c99a4

Copy link
Member

@dblandin dblandin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 💯

Thanks for tracking this down! Going to go ahead and merge so it's included in the Monday morning beta build.

@dblandin dblandin merged commit b18bdf4 into main Oct 26, 2024
8 checks passed
@dblandin dblandin deleted the anandaroop/rail-image branch October 26, 2024 12:23
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.

4 participants