Skip to content

fix issue in orientation of images#21458

Merged
PureWeen merged 11 commits into
dotnet:mainfrom
stephen-hawley:image-orientation
Apr 14, 2024
Merged

fix issue in orientation of images#21458
PureWeen merged 11 commits into
dotnet:mainfrom
stephen-hawley:image-orientation

Conversation

@stephen-hawley

Copy link
Copy Markdown
Contributor

Description of Change

Added code to retrieve image orientation from the metadata, translate it and apply it to the image constructor.

Issues Fixed

Fixes #21314

In brief, pull the image properties from the CGImageSource and translate it to the values for the UIImage constructor.
The conversion code was based on this documentation from Apple.

@stephen-hawley stephen-hawley requested a review from a team as a code owner March 26, 2024 15:56
@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Mar 26, 2024
@PureWeen PureWeen requested review from PureWeen and removed request for jfversluis March 26, 2024 16:03
@PureWeen

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

dalexsoto
dalexsoto previously approved these changes Mar 26, 2024

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

❤️

return image;
}

static UIImageOrientation ToUIImageOrientation (CGImageSource cgImageSource)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code format is not quite right :) seems mono days? we provide the rules in a .editorconfig..

Our dotnet format on this file only will also work.

@rmarinho

Copy link
Copy Markdown
Member

Will this be a breaking change? Like before images will always appear UP and now can show in a different orientation? Should we target this only to net9 ?

@jsuarezruiz jsuarezruiz added the area-controls-image Image control label Mar 27, 2024
@dotnet-policy-service dotnet-policy-service Bot added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Mar 27, 2024
@stephen-hawley

Copy link
Copy Markdown
Contributor Author

Will this be a breaking change? Like before images will always appear UP and now can show in a different orientation? Should we target this only to net9 ?

Not really, no. It restores correct behavior that was in place before February 16th.

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a UITest? our docs are somewhat lacking in that area but you can see an example here.

#20352

I think you could either do a screen shot or check the dims of the image to make sure it renders the right direction

@PureWeen PureWeen requested a review from jsuarezruiz March 28, 2024 23:45
@PureWeen

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@stephen-hawley

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 21458 in repo dotnet/maui

@mattleibow

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@stephen-hawley

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 21458 in repo dotnet/maui

@mattleibow

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

mattleibow
mattleibow previously approved these changes Apr 13, 2024
@PureWeen

Copy link
Copy Markdown
Member

/rebase

@github-actions github-actions Bot force-pushed the image-orientation branch from bd19057 to 40b3a74 Compare April 13, 2024 13:39
@PureWeen

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen

Copy link
Copy Markdown
Member

Test failures unrelated

@PureWeen PureWeen merged commit ea369b9 into dotnet:main Apr 14, 2024
@stephen-hawley stephen-hawley deleted the image-orientation branch April 22, 2024 13:57
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image displays JPG photos taken in Portrait orientation in Landscape orientation (regression in 8.0.10)

8 participants