Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Export to .ico not working correctly
#11
(03-25-2022, 03:49 AM)rickk Wrote: Papabear said:   (But this does beg the question - if one can send only visible layers to .gif and to .tiff - why not .ico? I just don't see the reason for forcing the extra steps of creating some other file, opening that file, and then exporting again to an .ico...)




I think I have the solution you are looking for.  After you finish compositing the layer you intend to have visible, just drag it to the bottom of your layer stack, before exporting as an .ico file
As depicted in the attached ...below,  in the layers dialog on the far right.   You want the image you intend to have visible sitting in the slot that I've named "Bottom"
And then be sure in your export dialog to have a color depth specified for that layer (as I've specified " 8 bpp, 1-bit alpha, 256-slot palette"
And you'll be all set. The layers you've made invisible will be preserved, just not able to interfere with your image.
[Image: aDf9I9w.png]

Hmmm --- bottom of the list - never would have thought that should matter. Quite interesting. 

I was with you until you last statement.  Not sure how to be sure a particular color depth is specified. Are you saying to be sure a palette is specified? I gave this a whirl, and it still generated an .ico file that did not look like the desired layer (...it used some other layer - about 5 from the top - I have about 13 layers in there. Not sure how it is choosing...) (Update: Several tries later - this seems to have worked - so I don't know what changed to make it work when it did not at first... oh well... I'll keep trying this each time to see if it works reliably going forward.)

Sure would be nice if that list of layers also had an "Include" check-box, that defaulted to true for visible layers. That would solve this whole riddle as to what will or won't go into the .ico file.
Reply
#12
Going back to the beginning Wink

Quote:...I have merged several layers into one layer, and I'm simply choosing that single, merged layer to export. (Not even trying to do the multi-size thing.)

When something like that occurs, reduce to the simplest image.
Go to the top of the layer stack, make a Layer > New-from-visible
Drag that layer (Visible) into the toolbox to open as a new single layer image.
Does that look like your required icon ?
Export that as a Windows .icon
Does that look as expected ? If not, how are you viewing the .icon
Reply
#13
(03-28-2022, 12:21 PM)rich2005 Wrote: Going back to the beginning Wink

Quote:...I have merged several layers into one layer, and I'm simply choosing that single, merged layer to export. (Not even trying to do the multi-size thing.)

When something like that occurs, reduce to the simplest image.
Go to the top of the layer stack, make a Layer > New-from-visible
Drag that layer (Visible)  into the toolbox to open as a new single layer image.
Does that look like your required icon ?
Export that as a Windows .icon
Does that look as expected ? If not, how are you viewing the .icon

Right - I think we're on the same page - almost.  I have used New-from-visible to create the desired final image/layer etc.  And I do have a process to generate what I'm after --- So, that's cool... 

I guess I'm not sure about that 3rd step - i.e., what you mean by "... into the toolbox to open as...".  It sounds to me like we may still be creating a separate file in order to accomplish the export to an .ico file.  Not a big deal at all - but it just seems inconsistent to require that step - *only* for windows icons - but not for other file types.  I hope that is making sense but maybe I'm still not getting something. 

It would be so straightforward to just have an "Include" checkbox on each layer *within* the export options window - defaulted to True for what is visible.  Then I can have one Gimp project file, and from that project, I can directly generate an .ico file with whatever layers I so choose - during export -without creating additional files that I then have to save/manage.
Reply
#14
Quote:..I guess I'm not sure about that 3rd step - i.e., what you mean by "... into the toolbox to open as...".  It sounds to me like we may still be creating a separate file in order to accomplish the export to an .ico file.

Correct. When there is a problem with your workflow, revert to the simplest possible solution until it is sorted.

Quote:It would be so straightforward to just have an "Include" checkbox on each layer *within* the export options window - defaulted to True for what is visible.  Then I can have one Gimp project file, and from that project, I can directly generate an .ico file with whatever layers I so choose - during export -without creating additional files that I then have to save/manage.

Well, it is generally, what you describe is a Gimp template, but since we do not know the constituents of your icon file. Very probably a layer mode is screwing things up, so you get a "deal-with-unknowns" type answer.

The drag into tool box for a new image, is just that. Gimp is good at click-drag-drop for many functions. Make a new temporary image, export it, delete it.
This example, using a script from here: https://www.gimp-forum.net/Thread-Iconif...5#pid26485  256x256 canvas to make a multilayer icon. Then a check in an image viewer.

1 minute animation demo: https://i.imgur.com/7MuKfAZ.mp4
Reply
#15
(03-28-2022, 02:51 PM)rich2005 Wrote:
Quote:..I guess I'm not sure about that 3rd step - i.e., what you mean by "... into the toolbox to open as...".  It sounds to me like we may still be creating a separate file in order to accomplish the export to an .ico file.

Correct. When there is a problem with your workflow, revert to the simplest possible solution until it is sorted.

Quote:It would be so straightforward to just have an "Include" checkbox on each layer *within* the export options window - defaulted to True for what is visible.  Then I can have one Gimp project file, and from that project, I can directly generate an .ico file with whatever layers I so choose - during export -without creating additional files that I then have to save/manage.

Well, it is generally, what you describe is a Gimp template, but since we do not know the constituents of your icon file. Very probably a layer mode is screwing things up, so you get a "deal-with-unknowns" type answer.

The drag into tool box for a new image, is just that. Gimp is good at click-drag-drop for many functions. Make a new temporary image, export it, delete it.
This example, using a script from here: https://www.gimp-forum.net/Thread-Iconif...5#pid26485  256x256 canvas to make a multilayer icon. Then a check in an image viewer.

1 minute animation demo: https://i.imgur.com/7MuKfAZ.mp4

Cool - I took a peek - and the iconify looks handy. It does have me thinking that I should probably make .ico files with multiple sizes in them. I also heard that Windows can now auto-size them and I could simply build the 256x256 and let Windows handle the shrinking. May experiment with that.

From that animation - I NOW see what you meant by 'drag to the toolbox'. I absolutely NEVER would have EVER thought to do that. Not in a million years. To me - tools go in toolboxes - only. The idea of dragging an image in a layer - to the toolbox is just 'out there'. Ha...

I guess the bottom line though - as far as making .ico files - is that one MUST create a separate file that contains ONLY the layers to be included. For some reason - no one seems interested in making this easy directly from the Gimp project file. Again- not a biggie - but it seems other file types allow only the visible layers to be exported directly - but not .ico. I still don't understand why it is singled out to disallow that. But I appreciate everyone's time - I think I'm now understanding how to do this with Gimp.

Thanks!
Reply
#16
Papabear said: Hmmm --- bottom of the list - never would have thought that should matter.


Well, you've now gotten the big dog's attention, so you can't go wrong in following his advice. I'll not risk confusing the issue with further input.
Except to say that perhaps the biggest challenge I faced in learning to use gimp, was in trying to discover how to use all the tools the way the authors/creators intended them to be used. Some of the most powerful features are also the least intuitive.
Which is why I was trying to encourage you to create a new image containing only  the component you desired, and then export your end product  from that.   Or as Rich says "simplify your work flow".  Smile 
By eliminating any variables that might go wrong or unnecessarily complicate your work , in so doing you amplify your chances for success. That's what I was (initially) trying to encourage you to do


Reply
#17
(03-28-2022, 04:35 PM)rickk Wrote: Papabear said: Hmmm --- bottom of the list - never would have thought that should matter.


Well, you've now gotten the big dog's attention, so you can't go wrong in following his advice. I'll not risk confusing the issue with further input.
Except to say that perhaps the biggest challenge I faced in learning to use gimp, was in trying to discover how to use all the tools the way the authors/creators intended them to be used. Some of the most powerful features are also the least intuitive.
Which is why I was trying to encourage you to create a new image containing only  the component you desired, and then export your end product  from that.   Or as Rich says "simplify your work flow".  Smile 
By eliminating any variables that might go wrong or unnecessarily complicate your work , in so doing you amplify your chances for success. That's what I was (initially) trying to encourage you to do

Indeed.

It does seem that for creating .ico files - one must create a separate file (not the Gimp file), and we must be sure that ONLY the layers to be included exist in that file.  I really appreciate getting answers here - so thanks very much for the advice, feedback, and input!  You all got me on track quickly!
Reply
#18
I think I can reproduce such an issue that strangely seems to have to do something with the ICO format only.

Here are the simple steps to reproduce it:
  1. Open the To_Do.svg image attached in GIMP (I got version 2.10.34).
  2. When asked for the size of the SVG enter 128 width, height automatically changes to 104.
  3. Click OK.
  4. Now Select Image => Canvas Size´.
  5. Enter a new height of 128 px
  6. Click Centre (you may have to click it twice since the size changes not before the width input field has lost focus).
  7. Ensure that the Resize Layers dropdown shows None.
  8. Click Resize.
  9. As a result you will see the layer as shown here:
       
    Note that the image layer is a little smaller than the canvas.
  10. Now export it to, say, PNG => the resulting png has a correct size of 128x128 px
  11. Now export it to ICO => the resulting png has an (imo) incorrect size of 128x104 px as has the only layer in our image.
  12. You can get a correct result if you resize the layer to the canvas size using Layer => Layer Boundary Size.
  13. Now the ICO export also has a size of 128x128 px.
  14. You could have achieved a correct result from the outset if you would have chosen Resize Layers => All Layers in the Set Image Canvas Size dialog.
Nevertheless since that behaviour only occurs in ICO export it seems to be a bug to me.

Oh, and I nearly forgot: Don't get confused with the icon cache when using Windows. Win heavily caches icons so that you never know what the icon really looks like just relying on the icon shown in Explorer. You will see the real content when opening the icon in GIMP or when you rename the icon to a name that did'nt exist before. Alternatively you can clear the icon cache using a batch file with this content:

Code:
@echo off
taskkill /f /IM explorer.exe
CD /d %userprofile%\AppData\Local\Microsoft\Windows
del /f /s /q Explorer\iconcache*.*
Start explorer.exe


Hope some of you might find all that useful in that a bit of a special use case here (that's why I don't dare to hop this is getting fixed soon...).


Attached Files
.svg   To_Do.svg (Size: 2.98 KB / Downloads: 43)
Reply
#19
I don't think it is a bug. Icons are special animals, the icon file contains several images at different sizes (because icons are small and resize algorithms generate pixels soup, so the resizing is done "manually"). So when you export, each layer of the image becomes one of the available icon sizes. So when you have several layers:

   

You are asked which one to include:

   

And they are all part of the output, at their actual size:

Code:
> identify /tmp/Sample.ico
/tmp/Sample.ico[0] ICO 16x16 16x16+0+0 8-bit sRGB 0.000u 0:00.000
/tmp/Sample.ico[1] ICO 32x32 32x32+0+0 8-bit sRGB 0.000u 0:00.000
/tmp/Sample.ico[2] ICO 64x64 64x64+0+0 8-bit sRGB 9326B 0.000u 0:00.000
Reply
#20
(03-24-2023, 02:10 PM)poheyi01 Wrote: I think I can reproduce such an issue that strangely seems to have to do something with the ICO format only.

Here are the simple steps to reproduce it:
  1. Open the To_Do.svg image attached in GIMP (I got version 2.10.34).
  2. When asked for the size of the SVG enter 128 width, height automatically changes to 104.
  3. Click OK.
  4. Now Select Image => Canvas Size´.
  5. Enter a new height of 128 px
  6. Click Centre (you may have to click it twice since the size changes not before the width input field has lost focus).
  7. Ensure that the Resize Layers dropdown shows None.
  8. Click Resize.
  9. As a result you will see the layer as shown here:

    Note that the image layer is a little smaller than the canvas.
  10. Now export it to, say, PNG => the resulting png has a correct size of 128x128 px
  11. Now export it to ICO => the resulting png has an (imo) incorrect size of 128x104 px as has the only layer in our image.
  12. You can get a correct result if you resize the layer to the canvas size using Layer => Layer Boundary Size.
  13. Now the ICO export also has a size of 128x128 px.
  14. You could have achieved a correct result from the outset if you would have chosen Resize Layers => All Layers in the Set Image Canvas Size dialog.
Nevertheless since that behaviour only occurs in ICO export it seems to be a bug to me.

Oh, and I nearly forgot: Don't get confused with the icon cache when using Windows. Win heavily caches icons so that you never know what the icon really looks like just relying on the icon shown in Explorer. You will see the real content when opening the icon in GIMP or when you rename the icon to a name that did'nt exist before. Alternatively you can clear the icon cache using a batch file with this content:

Code:
@echo off
taskkill /f /IM explorer.exe
CD /d %userprofile%\AppData\Local\Microsoft\Windows
del /f /s /q Explorer\iconcache*.*
Start explorer.exe


Hope some of you might find all that useful in that a bit of a special use case here (that's why I don't dare to hop this is getting fixed soon...).

Interesting point about Windows Caching. That explains some things for sure!  And Thanks for the script...  (Looks like another .bat (band-aid) file I'll need to create to work around MS Windows behavior... ha...)
Reply


Forum Jump: