DevToys-app / DevToys

A Swiss Army knife for developers.
https://devtoys.app/
MIT License
26.77k stars 1.44k forks source link

JPG Compressor doesn't work #1024

Closed StarHamster closed 6 months ago

StarHamster commented 8 months ago

Current behavior

I select an image I want to compress and the process ends immediately with 0.00%.

Expected behavior

The image should be compressed.

Screenshots

image

Affected platforms

Windows

Affected DevToys kind

DevToys (app with GUI)

DevToys Version

Version 1.0.13.0 | X64 | RELEASE | 2706c6c2 | 2706c6c2

dschonholtz commented 7 months ago

JPG Compressor doesn't work

https://github.com/veler/DevToys/issues/1024

Current behavior I select an image I want to compress and the process ends immediately with 0.00%.

Expected behavior The image should be compressed.

Affected platforms Windows

Affected DevToys kind DevToys (app with GUI)

Potential Causes of the problem

The JPG compressor tool is designed to reduce the file size of images by compressing them. The tool's workflow involves selecting an image file, which is then processed by the PngJpgCompressorService. This service uses an external compression tool (ECT) to compress the image and returns the result. If the compression process ends immediately with a 0.00% reduction, it could be due to several reasons:

Implementation Plan

To address the issue reported, the following steps could be taken:

  1. Verify that the external compression tool is installed and accessible by the PngJpgCompressorService.
  2. Check the PngJpgCompressorWorkMessage to ensure that the file path is correct and the file is accessible.
  3. Review the PngJpgCompressorService process execution logic to confirm that the external tool is being called correctly and that the output is being handled properly.
  4. Add additional logging to capture the output and errors from the external compression tool to aid in debugging.
  5. Test the compressor with a variety of image files to determine if the issue is consistent across different file types and sizes.
  6. If a bug is identified in the code, implement the necessary fixes and perform thorough testing before releasing an update.

By following this plan, developers can systematically investigate the issue and implement a solution to ensure the JPG compressor tool works as expected.

ECT Installation Verification

The application verifies the installation of the Efficient Compression Tool (ECT) during the image compression process. This verification is performed in the PngJpgCompressorService class, where the application checks for the existence of the ECT executable file. The relevant code snippet is as follows:

string ectFullPath = Path.Combine(Constants.AssetsFolderFullPath, Constants.EfficientCompressionToolFileName);
Assumes.IsTrue(File.Exists(ectFullPath), nameof(ectFullPath));

If the ECT executable is not found, the application assumes that ECT is not installed and will throw an exception. This check ensures that the compression service can proceed with the compression task. If ECT is not installed, the application is designed to warn the user accordingly, prompting them to install ECT to use the JPG compressor feature.

For more details on how the application handles the ECT installation verification, refer to the PngJpgCompressorService.cs file in the source code.

Disclaimer

Hey there,

I'm Doug, I'm a SWE working on a ticket specification bot to help get folks understanding specific bugs faster We are trying to test out our product on various open source repos like this one.

Here is what our bot churned out for this ticket. If you found it helpful or have feedback just reply to this comment, I'll be watching it. Otherwise, I just hope this is helpful. Our thing isn't ready to sell yet, but you can find more info on our website: www.AI-Maintainer.com

In the meantime, I haven't been paid to write C# in a looooonnngg time and the bot still gets stuff wrong, but looking at the code this seems at least like a decent starting point. If you could give feedback good and bad I'd love you for it. I genuinely hope this is just useful though.

veler commented 6 months ago

Thanks for the feedback. We're temporarily removing this tool from DevToys 2.0 and will bring it back later with cross-platform support. I will close this issue for now.