mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Image Resizer] Add option to remove metadata (#14176)
* Implements option to remove metadata (see #1928) * Add unit test * renamed settings switch, update ui text * Fix exception type, add justification for swallowing exception * Add unit test to check handling if no metadata is there in targetfile * Reordered the checkboxes as suggested by @htcfreek * Reduced size of test image
This commit is contained in:
committed by
GitHub
parent
9d9df949ef
commit
9ca32aa3ea
@@ -141,6 +141,15 @@ namespace ImageResizer.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove metadata that doesn't affect rendering.
|
||||
/// </summary>
|
||||
public static string Input_RemoveMetadata {
|
||||
get {
|
||||
return ResourceManager.GetString("Input_RemoveMetadata", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to R_esize the original pictures (don't create copies).
|
||||
/// </summary>
|
||||
|
||||
@@ -280,4 +280,7 @@
|
||||
<data name="Open_settings" xml:space="preserve">
|
||||
<value>Open settings</value>
|
||||
</data>
|
||||
<data name="Input_RemoveMetadata" xml:space="preserve">
|
||||
<value>Remove metadata that doesn't affect rendering</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -30,6 +30,7 @@ namespace ImageResizer.Properties
|
||||
private int _selectedSizeIndex;
|
||||
private bool _replace;
|
||||
private bool _ignoreOrientation;
|
||||
private bool _removeMetadata;
|
||||
private int _jpegQualityLevel;
|
||||
private PngInterlaceOption _pngInterlaceOption;
|
||||
private TiffCompressOption _tiffCompressOption;
|
||||
@@ -44,6 +45,7 @@ namespace ImageResizer.Properties
|
||||
ShrinkOnly = false;
|
||||
Replace = false;
|
||||
IgnoreOrientation = true;
|
||||
RemoveMetadata = false;
|
||||
JpegQualityLevel = 90;
|
||||
PngInterlaceOption = System.Windows.Media.Imaging.PngInterlaceOption.Default;
|
||||
TiffCompressOption = System.Windows.Media.Imaging.TiffCompressOption.Default;
|
||||
@@ -280,6 +282,27 @@ namespace ImageResizer.Properties
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether resizing images removes any metadata that doesn't affect rendering.
|
||||
/// Default is false.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Preserved Metadata:
|
||||
/// System.Photo.Orientation,
|
||||
/// System.Image.ColorSpace
|
||||
/// </remarks>
|
||||
[JsonConverter(typeof(WrappedJsonValueConverter))]
|
||||
[JsonPropertyName("imageresizer_removeMetadata")]
|
||||
public bool RemoveMetadata
|
||||
{
|
||||
get => _removeMetadata;
|
||||
set
|
||||
{
|
||||
_removeMetadata = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(WrappedJsonValueConverter))]
|
||||
[JsonPropertyName("imageresizer_jpegQualityLevel")]
|
||||
public int JpegQualityLevel
|
||||
@@ -423,6 +446,7 @@ namespace ImageResizer.Properties
|
||||
ShrinkOnly = jsonSettings.ShrinkOnly;
|
||||
Replace = jsonSettings.Replace;
|
||||
IgnoreOrientation = jsonSettings.IgnoreOrientation;
|
||||
RemoveMetadata = jsonSettings.RemoveMetadata;
|
||||
JpegQualityLevel = jsonSettings.JpegQualityLevel;
|
||||
PngInterlaceOption = jsonSettings.PngInterlaceOption;
|
||||
TiffCompressOption = jsonSettings.TiffCompressOption;
|
||||
|
||||
Reference in New Issue
Block a user