-
Notifications
You must be signed in to change notification settings - Fork 1
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
API to export image to PNG #3
Comments
icns encapsulates different type of images, mostly png though. In pratice you cannot be sure you'll get a png out of an icns so some conversion logic must be added to handle that case with imagemagick or whatever. I don't think the conversation part belongs to this project but I wanted to make a icns2png cli using icns.js ... If you simply want to get a png out of a icns file on OS X maybe you should use https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/iconutil.1.html ? Not sure if it's available on barebone OS X or with xcode / xcode cli though |
I cannot use
Hmm... If I am not wrong, formats are specified in the ICNS spec, so, my expectation that module will not only just read images list, but will also support extraction. Ok, thanks for clarification. I will try to fix it in my fork. |
Oh, that's why I made icns.js
Yes png is part of formats supported by icns but icns doesn't say your file MUST contain a png buffer. I found OS X default applications without png for example. That's why conversion is required if you want something reliable.
If you want I can have a look tonight or tomorrow and see what I can come up with |
BTW and out of curiosity can you elaborate on the use case? |
Please see electron-userland/electron-builder#239 (comment) In short: electron-builder converts OS X icns to linux icon set to build deb package. To simplify developer life. |
Ok so you need multiple sizes. So basically the utility would have to extract png from the provided icns, if a png is missing for a size get a png of higher size and scale down. If no png is suitable, get a file of different format and convert. Altough I'm not sure to understand why you need icns2png rather than png2icns, if you're building a cross platform solution wouldn't it be easier for the user and electron-builder to let the user provide a png of high resolution and build a icns based on that file? |
If you like the user provided png file approach I'd be happy to contribute to electron-build as my company uses it. https://redbooth.com/desktop-app |
icns.js lacks the ability to build icns file but I wanted to implemented that anyway and it's easy |
Sorry for misunderstanding, I need exactly export icns to pngs files. Not png2icns, but icns2png. Use case: user is already provide icns. I don't want to require yet another icon set for Linux. I want to convert existing icns file to png files on the fly.
Nice to hear it :)
So, maybe it is only for me, but I decided to make icns the primary format. |
png to ico is easy, how do you handle windows at the moment? icns to ico?
true Okay I guess icns should be a first class citizen, adding png support later would be awesome though as electron-builder would take care of creating the icns and wouln't have to build it myself but yes let's start with correct icns support. I'll merge my PRs, and see what I can come up with. |
We require ico file explicitly :) (https://github.com/loopline-systems/electron-builder#in-short "and icon.ico (Windows app icon)") For the same reasons as in my previous comment. |
So user must provide a ico and icns files. IMHO it really all comes down to the scope of electron-builder. For my use case I prefer the second solution because cross-platform application icon is more complicated than it looks like. |
I tried (to simplify, I merged #2 into my fork) and icns.js can read ICNS file.
But how I can export image to PNG? Required image not in the PNG format, so, it is a bit tricky ;)
I want a simple API like:
export(size, pngFilePath)
.The text was updated successfully, but these errors were encountered: