Icons with a resolution of 256*256 don't work

Just starting out? Need help? Post your questions and find answers here.
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Icons with a resolution of 256*256 don't work

Post by jacdelad »

Hi,
it seems that icons with a resolution of 256*256 don't work. Am I missing something?

Code: Select all

OpenWindow(0,0,0,300,300,"Test",#PB_Window_ScreenCentered)
CanvasGadget(0,0,0,300,300)
LoadImage(0,"C:\MyIcon.ico")
StartDrawing(CanvasOutput(0))
DrawImage(ImageID(0),0,0)
StopDrawing()

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Try it with an icon containing only one image at the resolution of 256*256, e.g. from https://iconarchive.com/. The icon which loads is significant smaller.
Trying a different icon at 128*128 loads it at full resolution.

Tested with Windows 10.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Icons with a resolution of 256*256 don't work

Post by BarryG »

Interesting. I recently tried to use a 256x256 icon with my exe but it looked horrible, so I abandoned the idea. I assumed I created the icon incorrectly, but jacdelad's post has made me now think I did it right but PureBasic is the problem.
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Icons with a resolution of 256*256 don't work

Post by idle »

this still works
viewtopic.php?t=55320
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Icons with a resolution of 256*256 don't work

Post by jacdelad »

You're using APIs and a lot of code, that's cheating. Sure, it works, but I think it should work using internal functions too. Or at least a warning in the help file.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Tawbie
User
User
Posts: 26
Joined: Fri Jul 10, 2020 2:36 am

Re: Icons with a resolution of 256*256 don't work

Post by Tawbie »

Hi jacdelad,

Your code appears to correctly display a 256x256 icon if the ico test file is uncompressed.

Tawbie
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Icons with a resolution of 256*256 don't work

Post by jacdelad »

Hi Tawbie,
I don't really understand. Icons are always uncompressed, I'm talking about *.ico files. Can you please provide the file? I'd like to test it (though I'm going to sleep right now, I'll answer later).
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Icons with a resolution of 256*256 don't work

Post by BarryG »

jacdelad wrote: Thu Sep 29, 2022 5:15 amIcons are always uncompressed
Not always. I discovered this when reading about adding a 256x256 ".ico" file to my exe. They can certainly be compressed.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: Icons with a resolution of 256*256 don't work

Post by RASHAD »

Hi jacdelad
Sleep well :D
It seems that PB has a problem with Loadimage() and Catchimage() with Icon format 256x256
For time been next is a Windows API solution

Code: Select all

OpenWindow(0,0,0,300,300,"Test",#PB_Window_ScreenCentered)
CanvasGadget(0,0,0,300,300)
;LoadImage(0,GetTemporaryDirectory()+"5WmWaBg1.ico")
imgid = LoadImage_(0,GetTemporaryDirectory()+"5WmWaBg1.ico",#IMAGE_ICON	,256,256,#LR_LOADFROMFILE	)
StartDrawing(CanvasOutput(0))
DrawImage(imgid,22,22)
StopDrawing()

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Egypt my love
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Icons with a resolution of 256*256 don't work

Post by Denis »

jacdelad wrote: Thu Sep 29, 2022 5:15 am Hi Tawbie,
I don't really understand. Icons are always uncompressed, I'm talking about *.ico files. Can you please provide the file? I'd like to test it (though I'm going to sleep right now, I'll answer later).
Normally, 256x256 icons are compressed (since MS Vista).
The format is png. They may not be compressed but the file is larger.

You can use my PureIconManager tool to see the contents of ico, exe, dll, Ne etc. files (with PureIconManager , you can extract one or more icons and create a dll, an ico or ne file, keeping compression or not).
PureIconManager

PureIconManager allows you to see if icons are compressed or not, see the preview below.
The red arrow on the left indicates that there is at least one compressed icon in the group.
On the right, the icons in the group are displayed, the arrow show how to see if icon is compressed or not.

For MS icon format see explanations here
https://www.axialis.com/docs/iw/Add_ima ... E_icon.htm
and
https://www.axialis.com/docs/iw/What_is_an_Icon.htm
$ Which image formats should I include in my icons?

Image
A+
Denis
Tawbie
User
User
Posts: 26
Joined: Fri Jul 10, 2020 2:36 am

Re: Icons with a resolution of 256*256 don't work

Post by Tawbie »

jacdelad wrote: Thu Sep 29, 2022 5:15 am . ... Can you please provide the file? ...
You can convert an image to an uncompressed ico file using Gimp.

RASHAD wrote: Thu Sep 29, 2022 5:45 am It seems that PB has a problem with Loadimage() and Catchimage() with Icon format 256x256
As a point of interest, LoadImage() appears to work fine with uncompressed 256x256 ico files. In fact, I just tried a 600x600 pixel uncompressed ico file and it displayed correctly using jacdelad's PB code (with appropriate window and canvas gadget size changes).
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Icons with a resolution of 256*256 don't work

Post by jacdelad »

Oh wow, thanks to everyone. I definitely didn't know that. I was adamant that icons are always uncompressed.
While I can load it via API, it would be best to be able to load it natively, also for the support of the other OSes.

I just woke up, and slept well, does it work when I use a UsePNGDecoder() in the code? Someone mentioned it's PNG-compreessed, maybe this works.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Icons with a resolution of 256*256 don't work

Post by Denis »

Tawbie wrote: Thu Sep 29, 2022 7:47 am
jacdelad wrote: Thu Sep 29, 2022 5:15 am . ... Can you please provide the file? ...
You can convert an image to an uncompressed ico file using Gimp.
with PureIconManager, you can create for example an ico file from a displayed file, regardless of the format of displayed file.
on the right (displayed content of selected group - selected group is on the left), with mouse select on or more icon, if more than one use CTRL key pushed, then (leave CTRL key) click right mouse button an then a menu will appear.
Select the format you want by clicking the menu item, the file will be created.

Image

it is also possible to save one or more groups
on the left, select one or more group with mouse (the first group selected is always the only one displayed on the right),
the same with CTRL key and then a menu will appear.
Select the format you want by clicking le menu item, the file will be created.
the contents of all selected groups will be added to the created file.

Image

be very very very careful with deleting icons, especially with system files, most of the time this is not possible (Microsoft limitation)
A+
Denis
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Icons with a resolution of 256*256 don't work

Post by ChrisR »

It looks very nice your PureIconManager Denis.
Still in beta 2, why no final version ?
It would be nice if you could have a https secure address. The images are not displayed here on Chrome and to see them I have to open them in a new tab. It seems possible on free.fr!

Edit: I see that you have just removed the images.
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Icons with a resolution of 256*256 don't work

Post by Denis »

ChrisR wrote: Thu Sep 29, 2022 6:56 pm It looks very nice your PureIconManager Denis.
Still in beta 2, why no final version ?
It would be nice if you could have a https secure address. The images are not displayed here on Chrome and to see them I have to open them in a new tab. It seems possible on free.fr!

Edit: I see that you have just removed the images.
Hi Chris and Thanks.


I work on different projects and I stopped the development of PureIconManager a bit. I use an improved but not complete version (support for images, Png, Jpg etc.), added background colorization because some icons do not appear on a white background (see screen capture).
The development takes a lot of time, I'm not a programmer, only an amateur. The development allowed me to know a little what an icon is, several years before obtaining a good result (interface in French or English without restarting).
There's hardly any explanation on the icons and it's a lot of tries to get a result.

I don't understand, I didn't remove any images, they appear on my computer.

Image
A+
Denis
Post Reply