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
#1797 Add checkbox to ribbon for user preference to compress images #1800
#1797 Add checkbox to ribbon for user preference to compress images #1800
Conversation
Hi @blewjy, good job on solving the issue! Tested on PowerPoint 2016 There is an issue when checking
I think you need to add a I also have a suggestion for the tooltip of People might not understand the what functionalities it affects even though it states Alternatively, maybe a |
Hey @ChesterSng, thanks for your review!
You're right about this, adding the function solved that issue.
To keep it consistent with the other buttons, I decided to add more detail to the tooltip instead. I listed out the features that were affected by this compress image setting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @blewjy, previous bug is fixed! Code LGTM
Was it tested on 2016? |
@leeyh20 Yup tested! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for one part!
|
||
if (ShouldCompressImages) | ||
{ | ||
GraphicsUtil.PictureExportingRatio = 96.0f / 72.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be better if these ratio values will be stored in GraphicsUtil as a constant so that if anyone wants to find these values then they will directly go to GraphicsUtil, not Ribbon1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! moved them into GraphicsUtil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and working on PPT2010.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry just one last thing!
// Picture exporting ratios | ||
private const float PictureExportingRatioHigh = 330.0f / 72.0f; | ||
private const float PictureExportingRatioCompressed = 96.0f / 72.0f; | ||
|
||
// Heuristics for image compression obtained through testing | ||
private const long targetCompression = 75L; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realised that these variables are lower-case while the above const float is upper-case for the first letter, could you standardise them according to https://github.com/oss-generic/process/blob/master/codingStandards/CodingStandard-CSharp.adoc ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Changed to camel case for private variabels.
Fixes #1797
Outline of Solution
Previously, when using
Crop to Shape
, high resolution images will be compressed after the crop. This is because we were exporting the images at 96ppi. This PR bumps this up to 330ppi to maintain a certain amount of quality on the pictures.Before:
After:
There is also a checkbox added to the main ribbon to allow users to decide if they would like images to be compressed. If this is checked, the image exporting resolution will be set back down to the original 96ppi.
Checkbox:
Note: this PR also affects other labs that use the same exporting and import method, including
EffectsLab
, thus the FT slides forEffectsLab
had to be updated.