implemented #21
This commit is contained in:
parent
17a71f1317
commit
ce1a828711
@ -10,17 +10,28 @@ namespace Mk0.Software.ImageSorter
|
|||||||
private string imagePath;
|
private string imagePath;
|
||||||
public string newFilePath { get; set; }
|
public string newFilePath { get; set; }
|
||||||
|
|
||||||
public Konverter(string imagePath, bool auto = false, string autoFormat = "")
|
public Konverter(string imagePath, bool auto = false, MagickFormat autoFormat = MagickFormat.Png)
|
||||||
|
{
|
||||||
|
this.imagePath = imagePath;
|
||||||
|
if (auto)
|
||||||
|
{
|
||||||
|
using (MagickImage image = new MagickImage(imagePath))
|
||||||
|
{
|
||||||
|
image.Format = autoFormat;
|
||||||
|
newFilePath = Path.Combine(Path.GetDirectoryName(imagePath), Path.GetFileNameWithoutExtension(imagePath) + "." + autoFormat.ToString().ToLower());
|
||||||
|
image.Write(newFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.imagePath = imagePath;
|
|
||||||
labelBildname.Text = imagePath;
|
labelBildname.Text = imagePath;
|
||||||
comboBoxFormat.SelectedIndex = 0;
|
comboBoxFormat.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonKonvert_Click(object sender, EventArgs e)
|
private void ButtonKonvert_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//todo konvertieren
|
|
||||||
using (MagickImage image = new MagickImage(imagePath))
|
using (MagickImage image = new MagickImage(imagePath))
|
||||||
{
|
{
|
||||||
if (comboBoxFormat.SelectedItem == "PNG")
|
if (comboBoxFormat.SelectedItem == "PNG")
|
||||||
|
@ -1291,9 +1291,25 @@ namespace Mk0.Software.ImageSorter
|
|||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void PictureBox_LoadCompleted(object sender, AsyncCompletedEventArgs e)
|
private void PictureBox_LoadCompleted(object sender, AsyncCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Error != null && Path.GetExtension(pictureBoxImage.ImageLocation).ToLower() == ".webp")
|
||||||
|
{
|
||||||
|
Konverter k = new Konverter(pictureBoxImage.ImageLocation, true);
|
||||||
|
if (File.Exists(k.newFilePath))
|
||||||
|
{
|
||||||
|
string del = pictureBoxImage.ImageLocation;
|
||||||
|
images[imageIndex] = k.newFilePath;
|
||||||
|
LoadPicture(imageIndex);
|
||||||
|
FileSystem.DeleteFile(del, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin, UICancelOption.DoNothing);
|
||||||
|
Image myImg = CopyImage.GetCopyImage(k.newFilePath);
|
||||||
|
ShowAutoConvertMessage(myImg, k.newFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Zoom();
|
Zoom();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maus-Fokus auf Panel2 bei MouseEnter
|
/// Maus-Fokus auf Panel2 bei MouseEnter
|
||||||
@ -1470,6 +1486,17 @@ namespace Mk0.Software.ImageSorter
|
|||||||
banner.ShowMessages();
|
banner.ShowMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Anzeige eines Banners bei automatischem Konvertieren von WEBP-Bildern
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bild"></param>
|
||||||
|
/// <param name="bildpfad"></param>
|
||||||
|
private void ShowAutoConvertMessage(Image bild, string bildpfad)
|
||||||
|
{
|
||||||
|
banner.Enqueue("Das WEBP-Bild \"" + Path.GetFileName(bildpfad) + "\" wurde", "automatisch konvertiert.", bild, Properties.Resources.converted);
|
||||||
|
banner.ShowMessages();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Anzeige eines Banners bei erstelltem Duplikat
|
/// Anzeige eines Banners bei erstelltem Duplikat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -231,6 +231,7 @@
|
|||||||
<None Include="Resources\border-2-topbottom-icon.png" />
|
<None Include="Resources\border-2-topbottom-icon.png" />
|
||||||
<None Include="Resources\border-2-leftright-icon.png" />
|
<None Include="Resources\border-2-leftright-icon.png" />
|
||||||
<None Include="Resources\border-2-all-icon.png" />
|
<None Include="Resources\border-2-all-icon.png" />
|
||||||
|
<None Include="Resources\converted.png" />
|
||||||
<Content Include="Resources\heic.ico" />
|
<Content Include="Resources\heic.ico" />
|
||||||
<None Include="Resources\inpaint-icon.png" />
|
<None Include="Resources\inpaint-icon.png" />
|
||||||
<None Include="Resources\inpaint-reloadfile.png" />
|
<None Include="Resources\inpaint-reloadfile.png" />
|
||||||
|
@ -220,6 +220,16 @@ namespace Mk0.Software.ImageSorter.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap converted {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("converted", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -259,4 +259,7 @@
|
|||||||
<data name="inpaint_reloadfile" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="inpaint_reloadfile" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\inpaint-reloadfile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\inpaint-reloadfile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="converted" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\converted.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
BIN
Mk0.Software.ImageSorter/Resources/converted.png
Normal file
BIN
Mk0.Software.ImageSorter/Resources/converted.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Loading…
Reference in New Issue
Block a user