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

ImageCompressionBear #1259

Open
jayvdb opened this issue Jan 5, 2017 · 9 comments
Open

ImageCompressionBear #1259

jayvdb opened this issue Jan 5, 2017 · 9 comments

Comments

@jayvdb
Copy link
Member

jayvdb commented Jan 5, 2017

git-lint (coala/meta#59) has a few linters for file formats that are not supported by coala, especially non-optional image compression detection for PNG and JPEG.

They are built using shell scripts that can be found in https://github.com/sk-/git-lint/tree/master/scripts/custom_linters , wrapping commonly used binaries.

jpegtran-linter.sh: The file size can be losslessly reduced from $origsize to $newsize bytes. ($reduction% filesize reduction)
optipng-linter.sh: The file size can be losslessly reduced from $origsize to $newsize bytes. ($reduction% filesize reduction)
pngcrush-linter: The file size can be losslessly reduced from $origsize to $newsize bytes. ($reduction% filesize reduction)

There are two python libraries which provide this type of functionality.

  1. https://pypi.python.org/pypi/imgutil
  2. https://github.com/sk-/optimage

The latter is by the same author as git-lint, so probably much better for our needs (and it does use more binaries to attempt to reduce the size of the image).

This is a medium difficulty bear proposal, as it works on binary file formats, which is not typical for coala and will likely cause some interesting problems to be solved.

@Makman2
Copy link
Member

Makman2 commented Jan 5, 2017

ooh that's cool :)

@Makman2
Copy link
Member

Makman2 commented Jan 5, 2017

though we don't have support for binary files yet, it was planned that FileProxy gets support for that^^

@jayvdb
Copy link
Member Author

jayvdb commented Jan 5, 2017

The FileProxy code I saw would be completely useless for this, as it was universal line based. That is actually why I objected to its prior design.

Also, as this would be a linter bear, a file proxy would be irrelevant.

@jayvdb
Copy link
Member Author

jayvdb commented Jan 5, 2017

I have created a GCI task for this : https://codein.withgoogle.com/tasks/4815242129309696/ (unpublished)

@Makman2
Copy link
Member

Makman2 commented Jan 5, 2017

we could change behaviour of FileProxy and supply a new field/property:

class FileProxy:
    ...
    @property
    def raw(self):
        """bytes object"""
         return self._raw

@Makman2
Copy link
Member

Makman2 commented Jan 5, 2017

and still maintaining a universal-newline version^^

@sils
Copy link
Member

sils commented Jan 5, 2017

This is a medium difficulty bear proposal, as it works on binary file formats, which is not typical for coala and will likely cause some interesting problems to be solved.

FWIW if we use optimage there won't be the possibility of using the coala in-memory files because omtimage works a lot with the file system directly.

@Makman2
Copy link
Member

Makman2 commented Jan 5, 2017

Also, as this would be a linter bear, a file proxy would be irrelevant.

and yes right, have forgotten that fact...

yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jan 13, 2017
ImageCompressionBear is a bear uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jan 13, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jan 13, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jan 13, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jan 13, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jan 13, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jan 13, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jan 15, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jun 14, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jun 14, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jun 14, 2017
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
@yukiisbored
Copy link
Member

coala's dependency_management is still not ready for systems that doesn't have supported package managers. Related issue: https://gitlab.com/coala/package_manager/issues/144

yukiisbored added a commit to yukiisbored/coala-bears that referenced this issue Jan 13, 2018
ImageCompressionBear is a bear which uses optimage, jpegoptim, jpegtran,
pngcrush, optipng to see if the image can be compressed and how much
bytes will be reduced if it's compressed.

Closes coala#1259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants