This project has moved and is read-only. For the latest updates, please go here.

Lossless compression

Mar 21 at 2:12 PM
Along with the code mentioned here for lossless compression, is it possible to give in more parameters for compression like quality etc

Mar 21 at 4:01 PM
Edited Mar 21 at 4:02 PM
Lossless compression means that you compress the image without any loss. You could try to disable lossless on the imageoptimizer to get a better compression. The loss is hardly noticable with jpeg images. And why do you want to specify the quality? Do you want to reduce it?
Mar 22 at 5:13 AM
Yes, its for reducing the file size of some of the images that we have. I'll try by disabling lossless.

There is another strange issue. Some of the images seems to be having format issues even though the extension is jpg when trying compress the jpegOtimizer throws an exception saying issues with file format. But when I tried renaming the images to .png the compression worked without issues. These images are end user uploaded ones and unfortunately there is no control over it. Do you have any suggestions for these like will it be possible in anyway to identify these images before being compressed.

Mar 22 at 6:03 AM
Edited Mar 22 at 11:48 AM
You could use MagickImageInfo te detect the actual format of the file. This will determine the format without loading the pixels. Are you using the ImageOptimizer class or the JpegOptimizer?
Mar 22 at 12:14 PM
Thank you the necessary info could be obtained from your suggested class. The ImageOptimizer is being used, its just that from the exception thrown it displays the JpegOptimzer class name also.

There is another doc that shows about using in a web application. But I could not figure out how it can actually be used. If you could show a simple example demo that would be useful.

Mar 22 at 2:51 PM
I am planning to create a demo website application next week. This will demonstrate how you could use it.