Code Monkey home page Code Monkey logo

imageoptim's Introduction

ImageOptim

ImageOptim is a GUI for lossless image optimization tools: Zopfli, PNGOUT, OxiPNG, AdvPNG, PNGCrush, JPEGOptim, Jpegtran, Guetzli, Gifsicle, SVGO, svgcleaner and MozJPEG.

Building

Requires:

git clone --recursive https://imageoptim.com ImageOptim
cd ImageOptim

To get started, open imageoptim/ImageOptim.xcodeproj. It will automatically download and build all subprojects when run in Xcode.

In case of build errors, these sometimes help:

git submodule update --init
cd gifsicle # or pngquant
make clean
make

imageoptim's People

Contributors

drewvolz avatar eitot avatar fil avatar gildas-lormeau avatar gingerbeardman avatar j-rg avatar jamesstout avatar jdorfman avatar jellyfrog avatar kasparsd avatar kedoubo avatar kornelski avatar kostandy avatar lgarron avatar mathbunnyru avatar mems avatar pathawks avatar peterkovacs avatar pluwen avatar radarhere avatar red1004g avatar sharkyrawr avatar sipayrt avatar tetov avatar tjscalzo avatar wiesmann avatar xiao99xiao avatar yeahdongcn avatar zwaldowski 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  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

imageoptim's Issues

Other AppleScript commands

Can you think of other commands we would like to access via AppleScript? I'm a novice at AppleScript, but learning quickly....

Enhancement ideas

Hi, like asked on twitter I will write down my suggestions :

  • A clear list button just to avoid restarting the software for the same result (not a big deal)
  • A setting to limit the cpu usage, cause it takes easily 100% of process and make my MacBook Air goes to 100°C easily and make lots of noise because of fans, and drains the batteries. Maybe the purpose is limited, but it would be nice anyway ^^
  • I'm always happy to see how much space I saved when using the software, could be good to be able to keep it from one time to another (one for the session, one for all the time)
  • A pause button could be good too

If I have more ideas I will come back 💃

PDF support

Love this product. Would like to use it for PDF support, or even a recommendation of another product you recommend.

Why the inconsistent output/Need for rerunning over and over?

Why is there not an option that says "Seriously, take as long as you need to compress". It's a waste of time to have to re-run the optimization over and over, then close, relaunch, and re-run over and over. The point of this is to be automated and to save on touch-time.

I demand the highest level of lossless compression. I use PNGOutWin, PngOptimizer, and PNG Gauntlet regularly and they all have their pros and cons. But none of them are inconsistent. Why is it that ImageOptim gives such random results. I'm fine if it takes 10 hours to compress 10 pngs. That's okay, I just want to know that after it's run I can actually trust the results.

Also there needs to be an option to clear the cache so I can force it to re-run the images that I know can be compressed better but the program feels as though they can't for some reason.

Not move files to trash

I don't like that the original files are just moved to the trash.

Presenting all the optimised files, and then replacing them yourself would be better in some cases. Therefore you could add a button at the end of the process saying "Replace with original files".

Or something like that.

pngcrush compile/link error

All was going fine until I just did a clean a then build. Now I get these errors:

/pngcrush/pngcrush.c:4323:17: warning: implicit declaration of function 'png_set_benign_errors' is invalid in C99 [-Wimplicit-function-declaration]
                png_set_benign_errors(read_ptr, 1);
                ^


Undefined symbols for architecture x86_64:
  "_png_set_benign_errors", referenced from:
      _main in pngcrush.o
ld: symbol(s) not found for architecture x86_64

New version of libpng needed?

UI for lossy/aggressive optimizations

I'd like to hear suggestions how to implement lossy optimizations:

  • pngquant can reduce PNG file size by 70%, but sometimes quality degradation is noticeable, and those files expose Photoshop's lousy PNG support (CS5 can't load them, CS6 can't save them).
  • Issue #5 — most SVG optimizations are unsafe if SVG contains scripts or author wants to keep editing the file.
  • JPEGs sometimes are stored with unnecessarily high quality, and there are tools like adept and JPEGmini that try to recompress JPEGs at lowest possible quality.
  • Converting non-animated GIFs, TIFFs, BMP to PNG or JPEG. What about filename extension?

So the problem is that in 90% of cases those optimizations are awesome, but in some cases they may ruin the file.

ImageOptim's ease of use mainly comes from the fact that it overwrites files in place with no fuss, but that can't be done with dangerous optimizations.

How could these optimizations be done? (all modal dialog boxes such as "Are you sure?" are out of the question :)

Ability to distribute work to other computers on your LAN

Some of the tools can probably be run on other computers on the LAN using ssh and piping the image data over the connection. When optimising hundreds of images on an old site, this could massively speed the process.

This probably needs quite a bit of discussion on the details of how it would work.

Statusbar is using significant amount of CPU

[filesController valueForKeyPath:@"[email protected]"] is pretty expensive (I hoped that observing that via KVO would allow Cocoa to maintain this value incrementally, but that's not the case).

Additionally coalescing of events via dispatch_source_set_event_handler() happens only after the handler starts to use 100% CPU time.

It should be rewritten with custom code that simply iterates arrangedObjects every second (or maybe a second after any file sends notification that size has changed).

Crash when invoked from cli

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018

VM Regions Near 0x18:
--> 
 __TEXT 0000000100000000-0000000100017000 [ 92K] r-x/rwx SM=COW /Applications/ImageOptim.app/Contents/MacOS/ImageOptim

Application Specific Information:
objc_msgSend() selector name: objectForKey:
objc[6279]: GC: forcing GC OFF because OBJC_DISABLE_GC is set
objc[6279]: '/Applications/ImageOptim.app/Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle' was compiled with -fobjc-gc-only, but the application does not support GC

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib   0x00007fff8ea525d0 objc_msgSend_vtable8 + 16
1 net.pornel.ImageOptim     0x0000000100005690 __29-[File setStatus:order:text:]_block_invoke + 107
2 net.pornel.ImageOptim     0x0000000100005607 -[File setStatus:order:text:] + 169
3 net.pornel.ImageOptim     0x0000000100003441 -[File initWithFilePath:] + 129
4 net.pornel.ImageOptim     0x0000000100006dc8 -[FilesQueue addFilePaths:] + 359
5 com.apple.Foundation  0x00007fff94e975ca __NSThreadPerformPerform + 225
6 com.apple.CoreFoundation  0x00007fff97168b31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
7 com.apple.CoreFoundation  0x00007fff97168455 __CFRunLoopDoSources0 + 245
8 com.apple.CoreFoundation  0x00007fff9718b7f5 __CFRunLoopRun + 789
9 com.apple.CoreFoundation  0x00007fff9718b0e2 CFRunLoopRunSpecific + 290
10 com.apple.HIToolbox  0x00007fff94537eb4 RunCurrentEventLoopInMode + 209
11 com.apple.HIToolbox  0x00007fff94537c52 ReceiveNextEventCommon + 356
12 com.apple.HIToolbox  0x00007fff94537ae3 BlockUntilNextEventMatchingListInMode + 62
13 com.apple.AppKit     0x00007fff9666f533 _DPSNextEvent + 685
14 com.apple.AppKit     0x00007fff9666edf2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
15 com.apple.AppKit     0x00007fff966661a3 -[NSApplication run] + 517
16 com.apple.AppKit     0x00007fff9660abd6 NSApplicationMain + 869
17 net.pornel.ImageOptim    0x0000000100001d24 start + 52

Switch to ARC—help needed!

Garbage collection has been completely removed from the latest Xcode.

The problem is conversion to ARC isn't as easy as advertised. Objects seem to be freed left and right. Globals? Freed. Block variables? Freed! Arguments to NSOperations? Freed!

If Scribble and Zombie Objects are enabled ImageOptim won't run even few seconds.

Method cache corrupted. This may be a message to an invalid object, or a memory error somewhere else.

HEEELP!

Lower Process Priority

Playing with 1.5.1 and it hammers all of the cores on my Macbook ... I was thinking it would be nice if the priority of the pngout/optipng/whatever else subprocesses were lower so I can still use my computer while this is going on in the background.

AppleScript

  • tell application "ImageOptim" to quit when done
  • property for total savings: get total savings of application "ImageOptim"?
  • change "do queuecount command" to a property?

Compiler Errors

When building this project I first received an error that sparkle.zip had not been downloaded. I assume that it was just not finished downloading by the time the compiler wanted to use it, because re-compiling fixed that issue.

After fixing that, the compiler gave me the following error:
No rule to make target 'tr.lproj/Help/Help.helpindex', needed by 'helpindexes'

After poking around a bit, I found that the help folders in the tr.lproj and vi.lproj folders both have an index.html file, but neither has the prefs.html file that every other *.lproj/help/ folder has. I moved the English prefs.html files into each and the project compiled.

Neither of these issues was particularly difficult to troubleshoot, but it would be convenient if the project compiled on the first attempt. You may want to consider making some changes to try and resolve these problems in the master repository.

Application Support folder filled with useless data

The Application Support folder for ImageOptim on my computer (located at ~/Library/Application Support/ImageOptim) has over time grown to 356 MB in size and is filled with lots of duplicate folders.

Following is a file listing of the folder (I excuse it's length, but I was not sure how else to present it).

$ ls -1
ImageOptim 1.4.0.8
ImageOptim 1.4.0.8 1
ImageOptim 1.4.0.8 2
ImageOptim 1.4.0.8 3
ImageOptim 1.4.0.8 4
ImageOptim 1.4.1
ImageOptim 1.4.1 1
ImageOptim 1.4.1 10
ImageOptim 1.4.1 11
ImageOptim 1.4.1 12
ImageOptim 1.4.1 13
ImageOptim 1.4.1 14
ImageOptim 1.4.1 15
ImageOptim 1.4.1 16
ImageOptim 1.4.1 17
ImageOptim 1.4.1 18
ImageOptim 1.4.1 19
ImageOptim 1.4.1 2
ImageOptim 1.4.1 20
ImageOptim 1.4.1 21
ImageOptim 1.4.1 22
ImageOptim 1.4.1 23
ImageOptim 1.4.1 24
ImageOptim 1.4.1 25
ImageOptim 1.4.1 26
ImageOptim 1.4.1 27
ImageOptim 1.4.1 28
ImageOptim 1.4.1 29
ImageOptim 1.4.1 3
ImageOptim 1.4.1 30
ImageOptim 1.4.1 31
ImageOptim 1.4.1 32
ImageOptim 1.4.1 33
ImageOptim 1.4.1 34
ImageOptim 1.4.1 35
ImageOptim 1.4.1 36
ImageOptim 1.4.1 37
ImageOptim 1.4.1 38
ImageOptim 1.4.1 39
ImageOptim 1.4.1 4
ImageOptim 1.4.1 40
ImageOptim 1.4.1 41
ImageOptim 1.4.1 42
ImageOptim 1.4.1 43
ImageOptim 1.4.1 44
ImageOptim 1.4.1 45
ImageOptim 1.4.1 46
ImageOptim 1.4.1 47
ImageOptim 1.4.1 48
ImageOptim 1.4.1 49
ImageOptim 1.4.1 5
ImageOptim 1.4.1 50
ImageOptim 1.4.1 51
ImageOptim 1.4.1 52
ImageOptim 1.4.1 53
ImageOptim 1.4.1 54
ImageOptim 1.4.1 55
ImageOptim 1.4.1 56
ImageOptim 1.4.1 57
ImageOptim 1.4.1 58
ImageOptim 1.4.1 59
ImageOptim 1.4.1 6
ImageOptim 1.4.1 60
ImageOptim 1.4.1 61
ImageOptim 1.4.1 62
ImageOptim 1.4.1 63
ImageOptim 1.4.1 64
ImageOptim 1.4.1 65
ImageOptim 1.4.1 66
ImageOptim 1.4.1 67
ImageOptim 1.4.1 68
ImageOptim 1.4.1 69
ImageOptim 1.4.1 7
ImageOptim 1.4.1 8
ImageOptim 1.4.1 9

Judging from their names it seems they are downloaded updates from the built in updater. Inside each folder is a compressed tarball and in most cases an ImageOptim.app:

$ ls -1 ImageOptim\ 1.4.0.8
ImageOptim.app
ImageOptim1.4.0.8.tar.bz2

Running a diff on some of the directories with the same version number return no differences:

$ diff "ImageOptim 1.4.1 35" "ImageOptim 1.4.1 37"
Common subdirectories: ImageOptim 1.4.1 35/ImageOptim.app and ImageOptim 1.4.1 37/ImageOptim.app

While others do:

$ diff "ImageOptim 1.4.1 35" "ImageOptim 1.4.1 36"
Only in ImageOptim 1.4.1 35: ImageOptim.app
Binary files ImageOptim 1.4.1 35/ImageOptim1.4.1.tar.bz2 and ImageOptim 1.4.1 36/ImageOptim1.4.1.tar.bz2 differ

Presumably this is because the updates were incomplete.

I'm running version 1.4.1a4.


This is the first issue I've ever submitted on GitHub so forgive me if it doesn't follow the proper formalities.

Optimize images in specific order.

It seems like presently(Version 1.5.4) images are optimized in random order.
It would be nice if they were optimized based on column sort(name or size).

Build fails on Xcode 4.6.3

Checked out the latest revision to see if I could fix some bugs myself, but the project doesn't compile under Xcode 4.6.3.

"CpResource el.lproj/Credits.html /Users/sulka/Library/Developer/Xcode/DerivedData/ImageOptim-ajzdjkeuiucvziccxzdccoiooqjy/Build/Products/Debug/ImageOptim.app/Contents/Resources/el.lproj/Credits.html
cd /Users/sulka/Desktop/ImageOptim/ImageOptim/imageoptim
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /Users/sulka/Desktop/ImageOptim/ImageOptim/imageoptim/el.lproj/Credits.html /Users/sulka/Library/Developer/Xcode/DerivedData/ImageOptim-ajzdjkeuiucvziccxzdccoiooqjy/Build/Products/Debug/ImageOptim.app/Contents/Resources/el.lproj

error: /Users/sulka/Desktop/ImageOptim/ImageOptim/imageoptim/el.lproj/Credits.html: No such file or directory"

There's also a warning about a missing dependency: Missing dependency target "Sparkle (from Sparkle.xcodeproj)"

Typo in Help/prefs.html?

On line 50:

"PNGOUT is not bundled with ImageOptim. It's a great tool, but and author of PNGOUT..."

Should that be:

"PNGOUT is not bundled with ImageOptim. It's a great tool, but the author of PNGOUT..."

Transifex for translations

If you haven't heard of it, Transifex is a modern, open-source localization platform - it’s a web system which automates the translation workflow for complex international projects.

I've started an ImageOptim project and have already added Greek and Lithuanian and had improved Russian translations. See here and here. My test Russian branch is here.

I'm not sure if this is something you want to progress, but there has been interest without any notification/advertising. It would be quite a bit of work - that I'm happy to help with.

To use Transifex efficiently, it requires the installation of the client or a lot of shell scripting to use cURL.

The initial process is

  • Generate a source Localized.strings file with genstrings
  • Generate source *.strings files for all *.xib files with ibtool
  • Upload the already translated strings files

For new languages

  • Add language to Transifex
  • Add lang.lproj folder to imageoptim
  • Add lang to .tx/config
  • Wait for translations to complete
  • Download using tx client
  • Convert to UTF-8 if needed (still trying to config this)
  • Use ibtool to create the localized xibs
  • Manually check the xibs look good.
  • Add to Xcode proj

For updated translations

  • Download using tx client
  • Convert to UTF-8 if needed (still trying to config this)
  • Use ibtool to create the localized xibs
  • Manually check the xibs look good.

Issues

Transifex cannot handle RTF files so Credits.rtf cannot be used. Suggest using Credits.html and:

[credits setEditable:YES];

NSAttributedString *tmpStr = [[NSAttributedString alloc] 
                        initWithHTML:[NSData 
                        dataWithContentsOfFile:[[NSBundle mainBundle] 
                        pathForResource:@"Credits" ofType:@"html"]]  
                        documentAttributes:nil];

[credits insertText:tmpStr];
[credits setEditable:NO];

However, there are further issues with HTML files and Transifex. Options:

  • Try to use current HTML files - they might work
  • Use PHP and gettext with .po msg files and a base template to produce the localized HTML files
  • Use Wikimedia's JQuery.i18n - not sure how NSAttributedString initWithHTML will handle this though.

Option to leave bit depth alone

It seems that some problems can arise when changing the bit-depth of some images.

OpenEmu/OpenEmu#1424

Is it possible to leave the bit depth alone, but apply all other compressions, or is just using Zopfli alone the best way around this? I recognize this is probably something of an edge case...

Re Issue 47: Clear resource fork

From the issue list:

Photoshop embeds thumbnails in filesystem metadata (xattr), which Finder includes in displayed file size

I responded with some questions:

If you deselect "Preserve file permissions, attributes and hardlinks" then resource forks etc are cleared.

Is the issue that even when "Preserve file permissions, attributes and hardlinks" is checked, the com.apple.ResourceFork xattr should be removed?

What about others? com.apple.FinderInfo or com.apple.quarantine?

Or is it just user misunderstanding of the options?

Anyway, I knocked up a method to remove xattrs in case you wanted to call it from somewhere or add another option - https://github.com/jamesstout/ImageOptim/compare/extAtt#diff-0

Retain ICC Profile

Is there a way to exclude ICC Profiles when the software strips data?

Support JPEGmini?

Would it be possible to support JPEGmini.app when it’s installed?

I noticed that after shrinking images using JPEGmini.app, ImageOptim can usually still save a few bytes. If ImageOptim could somehow trigger JPEGminification, it would save some time going back and forth between the two apps.

New Icon

ImageOptim icon is ugly. No doubt about it :)

However, despite the uglyness it does have two properties of a good icon: distinct shape and distinct color. The black splattered nobody-knows-what symbol clearly stands out in the sea of shiny silverish-with-hint-of-color tilted-rectangle icons.

I'd love to see a better-looking icon that still stands out (rather than being e.g. some variation of Preview.app's icon).

Also, I may need ability to migrate to the new icon gradually. The old one has been used for so long that's all over the web and people are used to it (call it Stockholm Syndrome if you like ;) I don't want to suddenly auto-update everybody's ImageOptim one day and have them wonder "where's ImageOptim gone!?!" (e.g. I could first make old icon with shade/color of the new one, then use new one, but maybe with darker outline, etc.)

The current crush-warning-sign symbol is obscure, so doesn't need to be kept.

I was thinking about icon with thick black scissors (to keep feel black X that current icon has) trimming away white border from a photo.

Alternative idea is a thick bundle of images squeezed in the middle with measuring tape (that could have KB symbols instead of cm/inch :)

open -a ImageOptim.app

If you execute

open -g -a ImageOptim.app file.png

from the command line, if ImageOptim is not already open, then the file is not added to the queue. If it's open already, then the file is processed as expected.

JPEGmini opening but not selecting files

I'm trying to use imageOptim with JPEGmini (installed from the app store) but when I do JPEGmini just opens, then opens the select file(s) dialog, then opens the "Go to folder" dialog, then it seems to just carry on. Checking the file sizes it's clear that JPEGmini isn't doing anything.

I've also sometimes got the erro message "JPEGmini got an error: User canceled."

Is there any way to fix this!?

Thanks

Printing ImageOptim images as PDF in Safari

I have used ImageOptim to optimize images for a website I'm working on. The images look great except when I try to "print" them as PDFs in Safari.

Here is a sample image as it appears in browsers:
orchestra
And here it is as it appears in a PDF "printed" from Safari:
orchestra-imageoptim

This problem occurs in Safari (and also in iCab), but not in Firefox, Opera, or Chrome (all on Mac).
Any suggestions for making the image behave in Safari?
Thanks!

pngquant

Is see that you have pngquant in the Reop, but it it not in binary for download on the site. Any way you could update that so we can use it ;) ?

docs request - list the default underlying calls to the various libraries

You seem to have some amazing settings going on here. It would be really great if I could tell what was happening behind-the-scenes a little bit better.

for example-- I've tried going through the xcode source to figure out the settings you pass to jpegtran but can't match up. i get a 7% reduction on a file with ImageOptim but only 3% calling jpegtran alone.

I'm wondering if there is a lossy compression going on.

Optionally skip files that have already been optimized

It seems like there should be an option to skip files that have been optimized. This would be particularly helpful to users of the CLI client for ImageOptim. Using the command line client on folders full of images that have all been optimized except for one is particularly painful.

How to make quitWhenDone true launch?

Hi,

I'm using NSWorkspace to launch ImageOptim.app, do you know how to make quitWhenDone true using this way?

NSWorkspace * ws = [NSWorkspace sharedWorkspace];
[ws openFile:[fileURL path] withApplication:@"ImageOptim"];

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.