I have all of Christians plugins, so hopefully he will join in here
So you already have GMImageMBS âŠ
If itâs in the complete plugins, then yes.
I wrote a xojo ICO exporter
Ok whoâs got a program that can open & show me an ICO file ? (EDIT - Never mind found one and the ICO is just as I wrote it)
Writing them is pretty dead simple except for the patch ups required but even thats not too bad
Not bad for half an hour
http://great-white-software.com/gws-rb-samples/ICO%20writer.zip
[quote=134837:@Norman Palardy]I wrote a xojo ICO exporter
Ok whoâs got a program that can open & show me an ICO file ? (EDIT - Never mind found one and the ICO is just as I wrote it)
Writing them is pretty dead simple except for the patch ups required but even thats not too bad
Not bad for half an hour
http://great-white-software.com/gws-rb-samples/ICO%20writer.zip[/quote]
Norman, you are the best
That code actually demoâs 2 techniques
- a memoryblock backing a binarystream (which is really handy)
⊠ummm âŠ
- oh yeah writing an ico file
There are lots of file formats that are not much different than ICO files (icns etc) and the only real trick is that the directory requires an offset to the item so you have to hang on to that offset and then back patch it before writing everything out
It could probably even be made simpler by just using the memory block size instead of manually tracking the offsets
There is a small issue : the file format is not recognized by Windows
opened fine here on my windows 7 & 8 vmâs in paint and greenfish
Thank you so much Norman,
I am sure that will help a lot of users!!!
Maybe because I used one png and one jpeg picture. The pictures were missing in your zip, so I picked whatever I found.
Now reading your code, I realize the picture format and dimensions must count.
What is the expected format of the pictures to use ? I assume their size is 30x30 ?
I thought that a .ico could contain multiple sized images - the same as .icns on OS X???
From what I can gather - Vist supports .ico image sizes up to 256 x 256, but not sure what 7, 8 and now 10 will support?
[quote=134847:@Michel Bujardet]Maybe because I used one png and one jpeg picture. The pictures were missing in your zip, so I picked whatever I found.
[/quote]
Shouldnât matter as I read whatever images & shove them out as pngâs
Sizes canât be more than 256 x 256 - but thats a limit of the ICO format
Now this code isnât perfect - far from it
Thereâs 0 error checking about all kinds of things
It can
That code will let you append a bunch of images then write one ICO
ICO files support up to 256
10 wonât be able to change that without breaking every ICO file
BUT they could use a different format (icon library with the icl suffix) and that could do something different
Thank you so much Norman for spending the time to do that for us all to learn from - very much appreciated
What kind of error checking should I check for, out of curiosity?
Thanks.
At the very least
- if you add an image that is larger than the support maximum you should do âsomethingâ
- If the image IS the maximum size (256) then the width or / & height should be set to 0 (they probably are not)
- if there are no images in it then you should probably not generate any valid header etc (not sure if thats a truly fatal error or not)
stuff like that
Cool - I will now look into incorporating those checks
Thank you!
[quote=134861:@Norman Palardy]Shouldnât matter as I read whatever images & shove them out as pngâs
Sizes canât be more than 256 x 256 - but thats a limit of the ICO format
Now this code isnât perfect - far from it
Thereâs 0 error checking about all kinds of things[/quote]
I have now tried under Windows 10. The icon is fine, but the program stumbles in Operator_convert at bs.Close on ioExceptionâŠ