EasyG0ing1 / MacIcns

MacIcns is a small program that will take any 1024 x 1024 png file and convert it into a proper MacOS .icns file.
Apache License 2.0
16 stars 4 forks source link

output file vanishes #5

Open scottbernardis opened 11 months ago

scottbernardis commented 11 months ago

I can actually see it create the "icon.iconset" in the same location as the png, but then it vanishes each time. Run from both gui and terminal. It's not invisible, it's not in the trash, I can't find it anywhere.

new to github, so pardon my issue submission if I did this wrong.

EasyG0ing1 commented 11 months ago

@scottbernardis Try this ... make a folder from the root of your profile folder called temp (or something) then put your png file in there and try it and see what happens. If you're watching the folder as the program makes the icns file, you should see a folder show up briefly then it gets deleted but what remains is the .icns file in its place. If you open the .icns file with Preview you'll see the different sizes in there.

EasyG0ing1 commented 11 months ago

@scottbernardis - one last comment about your concern

new to github, to pardon my issue submission if I did this wrong.

You actually did this perfectly. Issues are meant to be used for any discussion about a repository. I think the word "Issue" is a bit misleading though perhaps technically correct in it's purpose. When we hear the word "Issue" we think "PROBLEM" but in fact ... any topic being raised could be considered an "issue" in its raw definition. And that issue could be anything that anyone wants to say, whether it's a problem, or a compliment, or anything in between. ☺

scottbernardis commented 11 months ago

Thanks for the reply.It's over my head why that would help, but you are correct and it worked normally. Also, I did see the folder appear in vanish. I think it was icon.iconset?Thank You again.Sent from my iPhoneOn Nov 29, 2023, at 3:58 PM, Michael Sims @.***> wrote: @scottbernardis Try this ... make a folder from the root of your profile folder called temp (or something) then put your png file in there and try it and see what happens. If you're watching the folder as the program makes the icns file, you should see a folder show up briefly then it gets deleted but what remains is the .icns file in its place. If you open the .icns file with Preview you'll see the different sizes in there.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

scottbernardis commented 11 months ago

Excellent. I’m more new to submitting. Github content is often far more advanced than my knowledge, so I was hoping my issue wasn’t too "simple” -lol.

On Nov 29, 2023, at 5:11 PM, Michael Sims @.***> wrote:

@scottbernardis https://github.com/scottbernardis - one last comment about your concern

new to github, to pardon my issue submission if I did this wrong.

You actually did this perfectly. Issues are meant to be used for any discussion about a repository. I think the word "Issue" is a bit misleading though perhaps technically correct in it's purpose. When we hear the word "Issue" we think "PROBLEM" but in fact ... any topic being raised could be considered an "issue" in its raw definition. And that issue could be anything that anyone wants to say, whether it's a problem, or a compliment, or anything in between. ☺

— Reply to this email directly, view it on GitHub https://github.com/EasyG0ing1/MacIcns/issues/5#issuecomment-1832945611, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKVPKNABBAR2V7U2KSLTKTYG7MLNAVCNFSM6AAAAAA77CZUW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZSHE2DKNRRGE. You are receiving this because you were mentioned.

EasyG0ing1 commented 11 months ago

@scottbernardis I will make one suggestion ... in your reply - and as it is noted, the reply was made from your iPhone ... perhaps via an email? It came through a bit "messy" ... I would suggest for future engagement with github members that you remove all quoted text from your response and then make the very first word in the reply the at symbol with the name of the person you are addressing @EasyG0ing1 for example.

In the emails you receive from GitHub, there will be a link to view the message on the web. The web interface is far better suited for composing responses because it does things like auto fill names once you type the @ symbol and it lets you edit your reply in markdown so that you can format things better. Like in my last response to you, I quoted your sentence by putting the greater than symbol in front of it like this:

> new to github, to pardon my issue submission if I did this wrong.

that makes it look like this:

new to github, to pardon my issue submission if I did this wrong.

etc. etc.

And to your last response, in my opinion, there is no such thing as an issue that is "too simple" ... if it's something that you're experiencing and you've made efforts to try and get the results that you need, without success ... then by all means raise an issue. I tend to think that most people understand that others have varying levels of knowledge so that no question is out of bounds.

scottbernardis commented 11 months ago

@EasyG0ing1 I didn't even notice I had a web option. Looks like I have to switch out of Safari though, or it doesn't fully cooperate.

EasyG0ing1 commented 11 months ago

@scottbernardis I use Chrome, even on my iPhone ... Safari is a fine browser, but developers seem to prefer writing for Chrome primarily and letting other browsers figure it out. I don't necessarily like using Google products for various reasons, but for the time being, their browser seems to be the current dominant winner.

EasyG0ing1 commented 11 months ago

@scottbernardis I pushed an update to the program yesterday. After it creates the file, it gives you the option of opening the file in the Preview application to view it. I'm curious if you can re-create the scenario where the file was deleted after it was created. This would confirm whether or not the file was actually there.

here is the update link

scottbernardis commented 11 months ago

@EasyG0ing1

Test 1 (locations as noted below): Tried it, but it's still vanishing. I should clarify that what I am seeing is the "icon.iconset" folder appearing, then vanishing, and I'm never seeing the output. Also, I don't think I mentioned before, but the interface still gives the success message when no ICNS is produced. And, FYI, I'm storing the app about 9 levels deep, just while I'm sorting through all the methods I found to try. Input image is about 10 levels deep, but in the same father/grandfather folder as the app.

Test 2 (app and input image in same folder, still 10 levels down): Tried it. Same "icon.iconset" folder appearing, then vanishing, and still no output. and Interface still gives the success message.

Test 3 (app and input image together at the top level of user folder): Tried it. Success! Same "icon.iconset" folder appearing, then vanishing, but got the output ICNS this time (contents look good). Interface gives correct success message.

Test 4 (app and input image together on Desktop): Tried it. Success! Same "icon.iconset" folder appearing, then vanishing, but got the output ICNS this time (contents look good). Interface gives correct success message.

Was the "view file" button the new view option? Worked fine for me.

-Scott

EasyG0ing1 commented 11 months ago

@scottbernardis I added the last View button in light of this issue that you're having, so that in case others might experience it, there could be final confirmation that the file actually was created.

It sounds to me like what could be happening is that in your deep folder structure, you might have folder names with spaces in them ... and though I'm not 100% sure yet (at this moment) how Java passes command line arguments into shell calls, because the program leverages Javas built in ability to run terminal commands by calling on BASH (or ZShell) and running a program within that instance of the shell. I merely invoke the Java class that does this, tell it which arguments to give to the program that creates the icons and that's all the thought I give to that process.

One of those arguments of course is the path that you selected the file out of.

I'm going to look further into this to see if maybe having spaces in the any of the those nested folders could have been causing this issue. I might need to have that class enclose the path in quotes so that there's no issues.

EasyG0ing1 commented 11 months ago

@scottbernardis I just confirmed it. I created a folder off the root of my profile folder and put spaces in the name and sure enough it did exactly as you described. I saw the temp folder get created then removed, but then the icns file never showed up. I'll have this fixed within the hour.

EasyG0ing1 commented 11 months ago

@scottbernardis

Here you go give that a try it should work perfectly.

scottbernardis commented 11 months ago

@EasyG0ing1 It worked! But the view file button didn't do anything now. It never ends! lol

BTW, do you know an app/way to combine multiple PNG files into a single .ICNS, but the PNGs can be different resolutions and image? I wanted to make a test .ICNS to figure out which resolution any particular instance of an icon may be.

I've tried doing it on Preview, but after saving the file, you re-open it and it's always missing resolutions that were there when you saved it,.

I've tried a few scripts, but they either don't work, or claim ALL my source PNGs are bad.

The only thing that works so far (make sure View>'Show Image Background' is on), is taking an existing .icns into Preview, select thumbnail on left, select and manually cut corresponding image on right. Then, manually pasting a matching resolution of your new image on right. It works, but you are limited to whatever resolutions were in the original .icns.

scottbernardis commented 11 months ago

@EasyG0ing1 Edit on my question: Just now I noticed all my photoshop-created PNG files aren't pickable from 'Load Image' in your app. Maybe my PNG settings were wrong when I made them.

EasyG0ing1 commented 11 months ago

@scottbernardis The way I save PNGs from Photoshop is to use File / Export / Quick Export as PNG I actually have that mapped to a hot key on my keyboard so all I have to do is hit F16.

EasyG0ing1 commented 11 months ago

@scottbernardis

BTW, do you know an app/way to combine multiple PNG files into a single .ICNS, but the PNGs can be different resolutions and image?

The only way that I know of to make .ICNS files is to use the iconutil in Terminal. You first make an empty folder then put the different resolution images in it, then you run this command:

iconutil -c icns \path\to\folder\with\images -o \path\to\output\file.icns

Don't forget to surround the folder path with quotes if there are spaces in the folder name lol

EasyG0ing1 commented 11 months ago

@scottbernardis

It worked! But the view file button didn't do anything now.

Is this in the scenario where there is a space in the path to the file ... anywhere in the path?

scottbernardis commented 11 months ago

@scottbernardis The way I save PNGs from Photoshop is to use File / Export / Quick Export as PNG I actually have that mapped to a hot key on my keyboard so all I have to do is hit F16.

my photoshop is probably too old... CS6. I don't have that under export. Only (see screenshot) Screenshot 2023-12-03 at 9 48 17 AM

Is this in the scenario where there is a space in the path to the file ... anywhere in the path?

yes, and yup you win, that fixed it. views fine now.

The only way that I know of to make .ICNS files is to use the iconutil in Terminal. You first make an empty folder then put the different resolution images in it, then you run this command:


iconutil -c icns \path\to\folder\with\images -o \path\to\output\file.icns

Thanks, I tried, but it still hates me. I put 13 different resolution PNGs in a folder, and the command worked, but the output file only has 3 inside. I had been trying a number of ways and get similar results.

The only working way I have found so far is to take an existing .icns with the multiple resolutions you desire already inside it. Then literally select & copy (cmd-a, cmd-c) your desired same-resolution artwork from your source (probably PNG), manually erase the matching resolution slot's artwork, and paste into that spot.

I don't suppose you know how to take a resolution OUT of a .icns file? lol. I'm using Preview. I can cut the artwork, but the slot/placeholder still remains. Similarly, it won't allow me to export just one resolution to a new .icns, I always get a bunch

EasyG0ing1 commented 11 months ago

@scottbernardis

I put 13 different resolution PNGs in a folder, and the command worked, but the output file only has 3 inside. I had been trying a number of ways and get similar results.

I forgot to mention, you have to name the files in the temp folder specific names ... here's what I use in MacIcns:

icon_512x512@2x.png
icon_512x512.png
icon_256x256@2x.png
icon_256x256.png
icon_128x128@2x.png
icon_128x128.png
icon_32x32@2x.png
icon_32x32.png
icon_16x16@2x.png
icon_16x16.png

512x512@2x is actually 1024x1024 ... 256x256@2x is 512x512 etc.

The .icns format has some definition to it.

scottbernardis commented 11 months ago

@EasyG0ing1 I thought I was aware of the naming, but I had () around my @2xs. I took them off and actually got better results.

With ():

Screenshot 2023-12-03 at 3 23 24 PM

Screenshot 2023-12-03 at 3 23 29 PM

vs, Without ():

Screenshot 2023-12-03 at 3 23 32 PM

Screenshot 2023-12-03 at 3 23 37 PM

EasyG0ing1 commented 11 months ago

@scottbernardis

I thought I was aware of the naming, but I had () around my https://github.com/2xs. I took them off and actually got better results.

Apple and their picky ways it would seem ... ☺

scottbernardis commented 11 months ago

@EasyG0ing1 I don't want to call this a new issue unless you think it is, since I am sure there is probably a logical reason why it is the way it is...

When I use the app to generate ICNS files, the 128x128 @72 image inside is coming out as icon type "ic07", which WILL NOT display on High Serra when that resolution is needed. I know icon type "it32" WILL display for 128x128 @72. Any easy way to get the app to use it32 instead when it generates the ICNS files? Or will this mess something else up somewhere else?

thanks

EasyG0ing1 commented 11 months ago

@scottbernardis So the app takes your 1024x1024 png or jpg or whichever image file you use and it then creates the lower resolution images, it throws them into the folder then it just runs the iconutil program that comes with every mac and it does it by calling a bash or zshell in the background.

Java can pretty much manipulate images in any format for the most part but if you're talking about a native mac icon format of some kind, then if iconutil can generate what you want, then the app can do it.

Here's the description of the utility from its man page:

iconutil converts between '.iconset' and '.icns' files, and can extract icons from '.car' asset catalog files. The tool takes a single source '.icns' file, '.iconset' or a '.car' file and icon name. It converts the input to either a '.icns' or '.iconset' depending on the value of the -c flag's argument. It is possible to specify the name of the output file by passing the file path as the argument to the -o flag. If -o is not set iconutil will write converted '.icns' file or '.iconset' to the same directory as the source file using either the name of the icon in the '.car' or the input file name with the extension derived from the output type.

scottbernardis commented 11 months ago

@EasyG0ing1 Yeah, I'm about half lost, which is why I asked you -lol

I'm using Preview app just to quick inspect .icns files, and get details via the inspector window (see pic). That's where I was finding the "Icon Type" that was either "ic07" or "it32". ic07 seems to be the default/result [for 128x128] when creating the .icns. I have no idea how to manually generate it, or it32. I figured this would make more sense to you than me.

Screenshot 2023-12-14 at 11 06 33 AM

I tried a few methods to make .icns and I like the ease/results on your app the most, so I was hoping there was a solution somewhere that would allow me to keep using it.

I did jus try iconutil 6 times, but apparently I don't understand it enough yet to get the command input correct.

I figure I'll either end up finding a tool that can generate AS "it32", or find a way to edit the one "ic07" resolution in the .icns I already made.

EasyG0ing1 commented 11 months ago

@scottbernardis

I figured this would make more sense to you than me.

LOL ... well, you know what they say about assumptions ... ;-) though given your unfamiliarity with me, it was not a bad assumption and one I would have made as well - though I might have worded it as a statement / question so as to let the reader know that I don't have any context for what I'm referring to.

I just looked into it though, and that icon type field when you inspect the property / info of each different icon within the .icns file - those are static indexes that apple software can use to get a specific icon dimension from the icns file.

Here is the reference table for the different types

EasyG0ing1 commented 11 months ago

@scottbernardis

Here is the Wikipedia definition of the icns file format. I'm going to assume for the moment, that this is the most up to date version of that definition.

scottbernardis commented 11 months ago

@EasyG0ing1 I think I ran across that table while googling before. Interesting, but I don't know what to do with it.

EasyG0ing1 commented 11 months ago

@scottbernardis Most people wont know what to do with it ... I only mentioned it because I was pointing out that the Icon Type field isn't what you were thinking it was ... it isn't something that you can set during the conversion of the images into the ICNS file where you can control the quality of the image.

Also, check out this new version and let me know what you think of the user interface...

scottbernardis commented 11 months ago

@EasyG0ing1 you are correct. I was reading "icon type" and my brain was hearing "image format".

I hate to tell you, but the new app hates me. I get the downloaded file security warning like normal, I keep going, and it closes back into the Into the icon. Tried again now that no warning, and the icon just opens (effect) and closes (effect) right away. I never see any interface or anything.

edit: forgot to mention I tried an alternate account on same OS and got same result.

EasyG0ing1 commented 11 months ago

@scottbernardis Don't see an interface? OK when you download the DMG file and open it, you should see this

https://github.com/EasyG0ing1/MacIcns/assets/10106834/fa72da71-7918-470c-ae92-d40b0135b59d

Then when you run the program you should see this (the UI - User Interface)

https://github.com/EasyG0ing1/MacIcns/assets/10106834/b294b635-75f5-4e56-bdff-36954b76a580

EasyG0ing1 commented 11 months ago

@scottbernardis If you're getting the security warning about the app not being recognized, this is how you handle that:

Go into System Settings / Privacy & Security / Scroll to the bottom and click on Open Anyways ... You have to do that immediately after attempting to open the application and being denied.

scottbernardis commented 11 months ago

@EasyG0ing1 uh-oh, you've asked an OCD suffering designer for a design opinion.

Actually, I SHOULD be able to see the folder arrangement but mine looks different. See pic:

Screenshot 2023-12-16 at 12 14 12 AM

Regarding your folder dmg video...

  1. I want the input and output icons to be the same size. I know the input one is probably large to fit the format siffixes, so enlarge the output one to match.
  2. Any way to get rid of that little brown strip under the app icon when you select it? I'm guessing it's the file name.
  3. Otherwise, I like everything else.

Regarding the gui video...

  1. scoot the main artwork down so the apple stem/leaf isn't touching the top border/
  2. I like your yellow "drag to move" notes. I kind of want to put a "start here" one pointing at 'Load Image', but goes away when the other ones do. A bit redundant, but oh well.
  3. I like the green illuminated-looking button. It would be cool if the illumination moved on to the other buttons, as those steps happen (and is taken off the buttons it has passed). The others could be green too, or maybe you could do the same illuminated-looking effect with other colors.

Go into System Settings / Privacy & Security / Scroll to the bottom and click on Open Anyways ... You have to do that immediately after attempting to open the application and being denied.

There's a way easier way. Just control-click > open the subject file, and it will give you the same/similar warning, but now also an "open" button to bypass the warning. Only works the first time of course.

EasyG0ing1 commented 8 months ago

@scottbernardis Latest Build