GithubHelp home page GithubHelp logo

sketch-hq / sketch-image-compressor Goto Github PK

View Code? Open in Web Editor NEW
333.0 27.0 23.0 948 KB

A Plugin for Sketch that compresses your bitmap assets, to keep filesize to a minimum.

JavaScript 97.97% Shell 2.03%
sketch-plugin sketch-app sketchapp sketch sketch-plugins

sketch-image-compressor's Introduction

Image Compressor

⚠️ This plugin is no longer maintained. We recommend using ImageOptim instead.

A Plugin for Sketch that compresses your exported bitmap assets, to keep filesize to a minimum. This Plugin requires Sketch 3.8.

Please note that the compression is lossless, so no pixels will be harmed by running this Plugin : )

Installation

  • Download Sketch Image Compressor & unzip it.
  • Double click Sketch Image Compressor.sketchplugin to install the Plugin.

Usage

The Plugin uses two methods for asset compression:

  • Quick Compression happens automatically, whenever you export an asset from Sketch using the File › Export… menu option or the Export button in the toolbar. The Plugin will run your PNG & JPG assets through optipng and jpegoptim using the quickest settings for both, so that you get smaller files as fast as possible.
  • Full Compression happens when you choose the Plugins › Sketch Image Compressor › Export All Assets menu option. You'll be asked for a path where your assets will be exported, and then the Plugin will export every exportable layer from your document, and run the assets through advpng, optipng, pngcrush, zopflipng, jpegtran and jpegoptim, using more aggressive settings than the Quick Compression (i.e: the operation will be extremely slow)

Please note that both methods won't block Sketch's UI when running, so you'll be able to keep on working while the compressors run. However, running a Full Compression on a non-trivial document will most likely consume a lot of CPU for a long time, so don't expect Sketch to be as snappy as usual : )

You'll get some feedback about the process in the Sketch window while it's running, and some stats when it is done.

Acknowledgements

LICENSE

The MIT License (MIT)

Copyright (c) 2016 Bohemian Coding

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

sketch-image-compressor's People

Contributors

bomberstudios avatar briandrum avatar christianklotz avatar dependabot[bot] avatar intemperie avatar invisiblepixels avatar johanbrook avatar mathieudutour avatar pieteromvlee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sketch-image-compressor's Issues

Hard compressed images still after uninstall

I tried this plugin. Img quality of JPG was too low for me after compression, so I removed plugin (with Sketch plugin manager). But I realize compression with bad image quality after export remains. Any help?

Paths in artboard names aren't respected

With the built-in export (File->Export), if your artboard has a name like "foo/bar", then the artboard will be exported in a subdirectory called foo, aka foo/bar.png.

However, when running the plugin via Plugins->Sketch Image Compressor->Export All Assets, this information is lost, and the files are simply exported with the filename, i.e. bar.png.

No .sketchplugin file

README says:

Double click Sketch Image Compressor.sketchplugin to install the Plugin.

But there's no .sketchplugin file in the repo when downloading the master .zip.

Lovely plugin!

Hey, just want to complement you on a plugin well done. It works out of the box and was a breeze to install in Sketch. Thank you. 👍 😄

"Export All Assets" can swap files due to pngcrush shared tempfile

pngcrush uses a temp file (I believe pngout.png) when running. When "Export All Assets" is used, multiple NSTask's are created, all of which use pngcrush. One pngcrush can write to the temp file and then another pngcrush reads from it.

Steps to reproduce:

  1. Remove advpng and optipng from compress-full-png.sh. This ensures that pngcrush will always override the file rather than bailing.
  2. Export All Assets

The following document:

screen shot 2017-07-07 at 9 15 22 pm

Produces these results:

screen shot 2017-07-07 at 9 15 28 pm

Add toggle for TinyPNG compression

Hi there. I just have a small suggestion for this plugin. When exporting an artboard, image or whatever, it would be nice to have a nice checkbox in the export dialogue that you can turn on or off, which decides if the image will be compressed or not.

Sometimes we have to further edit images we export from Sketch in Photoshop or some other program and a lossless file would be better for that. Uninstalling the plugin every time you want to do so is a hassle, though.

I hope you consider this and I also want to say thanks for this great plugin.

No options?

Hello,

i have a bout 24 pages in my document with a lot of artboards ... :-)
I need a really important feature, like:

Only selected artboards (or layers / objects / pages ...)

Thanks

0% compression

After installing MacOS High Sierra Beta 6 plugin has stopped to compress. It always shows that image is 0.00% off.
issue

.sketchplugin file missing?

Hi,
In the installation instructions it says to double click on the Sketch Image Compressor.sketchplugin file, but it seems to be missing from the repo?

Should I be doing somethinh else?

Cheers
Damian

Plugin not working with Sketch 47.1?

I just installed Sketch 47.1 and somehow the plugin is not working anymore. Tried uninstalling it and reinstalling the most recent version. Not working means, it's not "firing" or "hooking" in when exporting an image from Sketch.

Might it be that the plugin is not compatible with this Sketch version?

Settings? (disable zopfli)

Hi, how to disable zopfli?
in imageoptim, Zopfli is the one that takes most of the time processing images, and found no filesize advantages by leaving it enabled in imageOptim. Want to do the same in Sketch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.