question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I wrote this script to generate all the required resources/ icons based on a single 1024x1024 image first placed in resources/icons/1024x1024.png:

Name this file make_images.rb and place it in resources/:

#!/usr/bin/env ruby

unless File.exists?("icons/1024x1024.png")
  STDERR.puts "Please create icons/1024x1024.png before running this script."
  exit 1
end

system "rm -f icon.ico icon.icns icon.png"

[16, 24, 32, 48, 64, 96, 128, 256, 512].each do |size|
  system "rm -f icons/#{size}x#{size}.png"
  system "convert -resize #{size}x#{size}! icons/1024x1024.png icons/#{size}x#{size}.png"
end

system "cp icons/256x256.png icon.png"

system <<-SYSTEM
  mkdir MyIcon.iconset
  sips -z 16 16     icons/1024x1024.png --out MyIcon.iconset/icon_16x16.png
  sips -z 32 32     icons/1024x1024.png --out MyIcon.iconset/icon_16x16@2x.png
  sips -z 32 32     icons/1024x1024.png --out MyIcon.iconset/icon_32x32.png
  sips -z 64 64     icons/1024x1024.png --out MyIcon.iconset/icon_32x32@2x.png
  sips -z 128 128   icons/1024x1024.png --out MyIcon.iconset/icon_128x128.png
  sips -z 256 256   icons/1024x1024.png --out MyIcon.iconset/icon_128x128@2x.png
  sips -z 256 256   icons/1024x1024.png --out MyIcon.iconset/icon_256x256.png
  sips -z 512 512   icons/1024x1024.png --out MyIcon.iconset/icon_256x256@2x.png
  sips -z 512 512   icons/1024x1024.png --out MyIcon.iconset/icon_512x512.png
  cp icons/1024x1024.png MyIcon.iconset/icon_512x512@2x.png
  iconutil -c icns -o icon.icns MyIcon.iconset
  convert icons/16x16.png icons/32x32.png icons/48x48.png icons/64x64.png icons/128x128.png icons/256x256.png icon.ico
  rm -R MyIcon.iconset
SYSTEM

system "cp icon.icns ../app/app.icns"

Would this be a good contribution to the project?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
amilajackcommented, Jun 21, 2018

OMG that would be so cool! If you can get a version that runs only on node instead of ruby and get it to work cross-platform then that will definitely get merged

0reactions
pavlobucommented, Jan 5, 2021

this script helped me to generate .icns from one source 1024x1024 png image:

https://github.com/jamf/icns-Creator

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Make Icons - Design & Illustration - Envato Tuts+
If you're having a hard time working on a project, the best idea is to take a step back and then focus on...
Read more >
How to Create Icons - YouTube
Do you want to use your own created icons on your desktop PC? This is possible and you can create it very easily....
Read more >
How to Create Icons: It's Easier Than You Might Think! - wikiHow
1. Find or make a base image. You can use any image file to create an icon, but it should have a resolution...
Read more >
How To: Create an Icon or Other Image | Microsoft Learn
To create a new icon or cursor ... In the Insert Resource dialog box, select Icon or Cursor and choose New. For icons,...
Read more >
7 Principles of Icon Design - UX Collective
Be clear first and foremost. Make the icon recognizable and readable. Never sacrifice clarity of what the icon represents. ... Brevity. Use as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found