-
Notifications
You must be signed in to change notification settings - Fork 784
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
Extract PNG images from Apple's "Apple Color Emoji.ttf" font #63
Conversation
Related to the colors, I'm not sure if this is at all relevant but since I ended up on this page when reviewing the TTFunk pull request, I figured I'd leave a link here: http://en.wikipedia.org/wiki/OpenType#Color |
Very very cool.
👍 |
So awesome. Three things before we can accept this PR:
👎 I want this library to be usable on all platforms not just the Mac. |
I just cut a new release of TTFunk (1.4.0) that includes @javan's patch. Hope that helps! |
Re: removing images. I personally don't care either way. The gem is hosted within your github account so you all can make the call. It would be nice to allow users to pick which size they want so I think we should either include all of the sizes in the gem or move the |
Yeah, please add a special case. We also have a special case for shipit squirrel being the only image that's not 64x64 px. I like having a test that verifies there are no duplicates. |
This increases the size of images slightly. I was able to shave it down locally to almost half size by means of:
I would like to make this a built-in task that follows the extraction of images, so the size doesn't go back up the next time someone runs the |
Thinking on this more, my preference would be to remove the emoji images from the gem and ship it with For non-Mac compatibility, we could create a separate gemoji-images gem or package them all up on S3 somewhere. |
Why do that? I thought that the whole point of removing images from this gem is to stop re-distributing what we don't have rights to. |
Well, I'd prefer not distributing the images at all, but you mentioned wanting to maintain compatibility with non-Mac platforms so I see that idea being a compromise. Splitting the images and the gem gives us a separate repo to take down should there ever be a copyright issue. |
On Mon, Sep 22, 2014 at 12:43 PM, Javan Makhmali [email protected]
I don't think we can compromise. If we want user-friendliness then we I could be convinced that we can drop the images in the next major release, |
How do you feel about adding other-sized images then? They'd be useful to anyone designing for multiple resolutions / font sizes and they're something we (Basecamp) have an immediate need for. Perhaps adding 32x32 and 160x160? Or go wild and add them all. |
On Mon, Sep 22, 2014 at 1:23 PM, Javan Makhmali [email protected]
I'm not too happy about adding different sizes. We'd have to name alternate Let's make this PR about just the extractor code, but without actually |
☑️ If anything, I think we should update the images and continue to have just the one size. Most of the current images were extracted long ago and have been subtly tweaked by Apple since (presumably to make them look better). Let's give gemoji a fresh coat of paint. |
Commands used: $ rake images:extract $ imageOptim -a -d images/emoji/unicode/ This required both ImageOptim and ImageAlpha to be installed as OS X apps.
Command used: $ imageOptim -a -d images/emoji/
@javan: I've ran the updated images through the optimizer and rebased this PR. Please take a look. I'm 👍 for packaging this as a next minor release, but in the future it might be better to not distribute the images at all but provide a task, like you originally suggested. We could also offer that you download one of the open source emoji sets as an alternative to using Apple's. |
Thanks for the 👀, @mislav! Happy to help get an image-less release going too. |
Extract PNG images from Apple's "Apple Color Emoji.ttf" font
Is this extract feature functional? I have little experience with Ruby and can't figure out how to run the extractor. |
require 'emoji/extractor'
Emoji::Extractor.new(64, "path/to/emoji/images").extract! |
Thank you! |
I found a way by terminal running "rake images:extract" it extracts the emojis but it doesn't extracts some of them. Thanks in advance |
The images currently included in this gem were extracted using https://github.com/tmm1/emoji-extractor and then renamed by hand (I think) to match their unicode hex values. emoji-extractor.rb uses a regex to parse out png data for each emoji, and isn't able to match them with their codepoints so they come out named sequentially (1.png, 2.png, etc.). See tmm1/emoji-extractor#1.
Today I dug in and figured out where and how all the bitmap bits are stored in Apple's emoji font (hint, right here) and added support to the ttfunk gem for parsing it all out (PR: prawnpdf/ttfunk#22). Combined with other character data in the font file, we now have enough information to identify and extract each emoji png at every available size (20x20, 32x32, 40x40, 48x48, 64x64, 96x96, 160x160).
You can see from this PR that many of the images have subtle color changes. I'm guessing that's because the originals were extracted long ago and Apple has since refined them.
One thought I had is that we could remove the included images from the gem and have people extract them on their own with a rake task.This would give them a choice of which size(s) to extract and wipe our hands clean of any copyright issues. What do you think?
cc: @mislav, @josh, @trevorturk, @aroben, @tmm1
🎉