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

Add support for reducing the size of image with lossless compression #1518

Closed
dlemstra opened this issue Mar 25, 2023 · 2 comments
Closed

Add support for reducing the size of image with lossless compression #1518

dlemstra opened this issue Mar 25, 2023 · 2 comments

Comments

@dlemstra
Copy link

The Magick.NET library contains an ImageOptimizer that can be used to reduce the size of an image with lossless compression. Would you be open to a pull request that adds support for this to ImageGlass? Not sure where should be added in the menu though. Maybe in the Image menu? And would you be okay with this only be added to the v9 branch?

@d2phap
Copy link
Owner

d2phap commented Mar 25, 2023

v9 is a good branch! Note that the source code of v9 is in the v9 folder.
Since the upcoming v9.0 beta 4 will support "Tools" menu, including built-in and external tools. This ImageOptimizer can be added as a built-in tool, may be called Image optimizer, in the Tools menu.

You can add a new ToolstripMenuItem called MnuImageOptimizer.

  • In FrmMain.IGMethods.cs, write a method IG_OptimizeImage().
  • In the click event of the menu MnuImageOptimizer_Clicked(), call the IG_OptimizeImage() function.
  • To show a message to user, there are 2 ways:
    • PicMain.ShowMessage() is for short time and unimportant message. It is usually dismissed after the task is done or exceed the duration from Config.InAppMessageDuration.
    • Config.ShowError(), Config.ShowInfo(), Config.ShowWarning() are for important and persistent message. It's only dismissed by the user.

For the external tools, it's loaded via the settings Tools in igconfig.json. The Exif tool from v8 will be decoupled as a standalone tool. Currently, I put a placeholder for it in the Tools menu:

image

The setting for external tool is as below:

/// <summary>
/// Gets, sets tools.
/// </summary>
public static List<IgTool?> Tools { get; set; } = new()
{
new IgTool()
{
ToolId = Constants.IGTOOL_EXIFTOOL,
ToolName = "ExifGlass - Exif metadata viewer",
Executable = "",
Argument = Constants.FILE_MACRO,
CanToggle = true,
},
};

@d2phap d2phap added this to the v9.0.10 milestone Jan 6, 2024
d2phap added a commit that referenced this issue Jan 6, 2024
@d2phap d2phap modified the milestones: v9.0.10, v9.1 Jan 31, 2024
@d2phap
Copy link
Owner

d2phap commented May 29, 2024

This feature is added in ImageGlass 9.1 Beta

image

image

@d2phap d2phap closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants