4 ms·
Show HN: One click image optimization for GitHub
- Raphmedia 12y agoWhat happens exactly when I click the button? It optimizes 50 images and put them in a separate commit?
- mwarkentin 12y agoBasically! When you click on the button, it will spin up a bunch of workers (1 for every 10 images). These will optimize your images in parallel, and then push the changes back up to a branch and open a pull request for you to review. There's no limit on the number of images - it can optimize hundreds quite quickly - 50 is the number of parallel workers you can have.
- occam65 12y agoSeems like a pretty useful tool, but I don't have any repos with images. Can anyone report on actual usage?
- mwarkentin 12y agoYou can check out an example of the pull request you'd get here: https://github.com/shrinkrayio/demo-images/pull/6 https://github.com/shrinkrayio/demo-images/pull/6
- occam65 12y agoNice. Does it report total filesize reduction across the entire pull request?
- mwarkentin 12y agoIt doesn't show you that info directly in the PR (as each worker doesn't know about the rest of what's going on), but I do track stats for each repo and make some (questionably useful) graphs available through the app. Here's an example screenshot: https://s3.amazonaws.com/snaps.michaelwarkentin.com/Shrinkray_2014-12-23_10-27-07.png https://s3.amazonaws.com/snaps.michaelwarkentin.com/Shrinkra...
- deleted 12y ago[deleted]
- mrbig4545 12y agoi'm not sure what it is, or why i would want it. or even what kind of optimising it does i'm not complaining, just suggesting that you should work on your homepage to make that crystal clear, it'll help with people who might want to use it but don't know it yet
- mwarkentin 12y agoThanks for the feedback - definitely know that there's lots of work to do. Planning on adding a short 30 second video running from sign up through to viewing the pull request.. surprisingly difficult to do smoothly without a bunch of "um" and "ah". More work on clarifying things will definitely be happening.. I've just put off showing this to people for too long already. :)
- mrbig4545 12y agoEven one small paragraph will help, something like, "When you click on the button, it will spin up a bunch of workers (1 for every 10 images). These will optimize the filesize of your images in parallel, and then push the changes back up to a branch and open a pull request for you to review. There's no limit on the number of images - it can optimize hundreds quite quickly - 50 is the number of parallel workers you can have" (i stole this off another of your comments and added filesize after optimise)
- mwarkentin 12y agoDefinitely.. thanks for the suggestion!
- lordbusiness 12y agoI'm assuming this is file size optimization for website use? It would be nice to see a video demo of this before I hand over my GitHub credentials. :-) Call me Mr. Paranoia if you wish; I apologize. I'm sure there are best intentions here. Nice idea to be honest. Wish I'd thought of it. :-)
- mwarkentin 12y agoExactly - well, anywhere you have images which you want to make sure are as small as possible (without losing any quality). We've had some success running this against repos for iOS apps and reducing the size of the bundle. Definitely planning on making a short demo video soon!
- lordbusiness 12y agoSounds good to me! Keep up the happy hacking. :-)
- mwarkentin 12y agoThanks, looking forward to spending some time on this over Christmas break. :)
- gingerlime 12y agoInteresting idea and quite clever way to integrate it with github. Very nice. Does it cost money? (if so, how much? if not, would it cost in future?) Does it continuously monitor all images or can be launched as a one-off task? I think some details are still missing.
- mwarkentin 12y agoAt the moment it's free for both public and private repos, but the plan is to follow the standard "Github tool" pricing (free for open source, paid for private / organization support). Happy to hear what people think they or their business would be willing to pay for a tool like this. :) Right now it's a one-off task, but I've done some work on using Github webhooks to trigger image optimizations directly on a branch while you're working on it. Not sure when this will be available though.
- colinbartlett 12y agoI just used it and I really like it. What would I pay for it is a harder question. Recurring charges are more difficult for me to swallow, but I would be willing to pay the equivalent of a few coffees or beers every time I used it.
- mwarkentin 12y agoThanks for the feedback. I was definitely leaning towards the subscription model, but am open to other ideas.
- Rygu 12y agoFun side-project, kudos. Also for humans: https://imageoptim.com/ https://imageoptim.com/
- mwarkentin 12y agoYep, there are definitely a bunch of ways to do this. A few of the reasons I made this rather than just using a CLI tool: * Speed - spinning up a bunch of workers to do this can optimize large repos a lot faster than my laptop * CPU - optimizing images on my laptop can really max out the CPU, turning on the fan, using up battery * Stats - I've wanted to make reports to send around to the company on the optimizations that were made - was quite hacky to pull this from a CLI report into something that could be shared
- perlgeek 12y agoI hate giving out write access to my repos to somebody I don't know. How about creating pull requests automatically instead?
- mwarkentin 12y agoYeah, understood that this could be an issue for people. I'd like to at least be able to split out granting access to public / private repos - although write to public could still be an issue.. What do you mean by creating PRs automatically instead?
- frabcus 12y agoYou could always fork repos to your own robot account, and then do the pull request from there.
- JangoSteve 12y agoIf your repo is private, then they'd either need a really large paid account and pay for the private fork they create of your repo, or they'd have to fork your repo as a public repo. Obviously neither is really an option. EDIT: Unless you mean just doing this for public repos, which would work, but doesn't solve the issue of private repos.
- jrochkind1 12y agoIt sounds like creating PR's is what you're doing, from other people's reports? Which is great. But Github tells me I'm about to grant you permissions to make commits directly to all my repos. Can you ask for fewer permissions from github? I haven't tried it myself yet, because it gave me a bad feeling giving you such permissions. (the permissions sound like they give full git commit access, which would of course include rewriting history. To a random third party? That seems like a terrible idea. If someone wanted to release such a service and use it to inject security vulnerabilities in everyone's (or just some specific targets) code....)
- 12y ago
- domedefelice 12y agoGaining the confidence of the user is not easy: 1) I think you should state explicitly that the compression is lossless (if it is); 2) You should provide some kind of demos/examples to look at. Good job anyway!
- mwarkentin 12y agoImage compression is lossless.. I really should call that out on the home page. Demo / examples are definitely on my list.. here's an example PR for you: https://github.com/shrinkrayio/demo-images/pull/6 https://github.com/shrinkrayio/demo-images/pull/6
- sauere 12y agoAlso, do you preserve metadata (EXIF etc.)?
- mwarkentin 12y agoI believe metadata gets stripped out, which is how I get some lossless size reduction for jpgs. In my experience, this is not something that we've been interested in preserving on our images (use case - websites). Would you be looking at using this to compress some photos for personal use, or for a photography website? What would be your use case?
- sauere 12y agoJPGs can be optimized without losing metadata. Google "jpegtran". It does some optimizing of the data representation while staying loseless.
- benbristow 12y agoIt would be nice to see a BitBucket version as well. Mainly because I keep my private repos on BitBucket since it's free and then do any open-source stuff on GitHub.
- mwarkentin 12y agoIt's something I may look at eventually, but not a priority right now - Github has a lot more users, and it would increase the complexity quite a bit to deal with two separate systems for permissions, APIs, etc. Thanks for the feedback though!
- mcmillion 12y agoAwesome idea, but this should really be a build step, not something people run manually, and definitely not touching the source images.
- mwarkentin 12y agoYep, if you've got something like this set up as a build step, good on you! A lot of places don't, so this was made as an easy way to reduce your image footprint. It's amazing how much can be saved sometimes.
- MichaelTieso 12y agoAfter clicking on "shrink all images" it goes to say "warming up" but nothing happens.
- mwarkentin 12y agoYeah, looks like I'm out of capacity on my workers right now - this is the first real burst of traffic I've had. As far as I can tell, all jobs are either queued or running, so it should complete for you at some point.. not sure if I can get an ETA for you though.
- mwarkentin 12y agoHey Michael, it looks like there were some errors with a few optimization jobs, including one of yours. If you want, you can try re-queuing the job by refreshing and then clicking on the button again.
- mwarkentin 12y agoSorry to anyone who this seems to be hanging for - it looks like my workers have gone over their capacity, and things are pretty queued up. I'm checking into increasing capacity, but in the meantime things may take longer than expected.
- mwarkentin 12y agoOk, it looks like the queue has cleared up for now. There were a few errors, so if one of your requests didn't complete, feel free to retry.
- jbox 12y agoCool tool! I gave it a shot on one of our private repos this morning and it did what it said on the box. In the process it also generated ~150 comments on the repo. For folks watching the repo, this is a fair amount of email. Is there anyway to aggregate the comments? Perhaps into the Pull Request description?
- mwarkentin 12y agoThanks for trying it out.. sorry about the spam. When I added the parallelization of the tasks, I kind of lost the ability to manage things centrally on Github. I'll think about if there's some way to make this better. Increasing the number of images per task would reduce the number of commits / comments, but could also increase the amount of time it takes to complete. Did the commits themselves cause email issues for you, or was it just the comments? I could look into appending to the PR description instead of adding comments - I'm just worried about a race condition when multiple tasks are trying to update the description at the same time.
- jbox 12y agoNo worries! It worked, we just got a lot of emails :) Could you aggregate the messages and post an update when the entire task is complete? Seeing the commits come seems to be a good progress indicator. If you are "watching" a repo, you get an notification for every comment, not every commit. You could also just create the PR with a link to the job on ShrinkRay and have the progress updates there...
- mwarkentin 12y agoI've added this to my issue list.. thanks for the suggestion!