When i put an icon in my application using the menu Project > Options > Load icon, it will allow me a max size of 32x32 pixels.
This size looks nice in the app window, but the problem is, when there is a shortcut to the app on Windows desktop or Start menu, the icon is stretched to a larger size and looks blurred.
Is there a way to put a larger icon size in my app resource file, so Windows can use the larger size when needed ? If so, how to do it ?
Thanks in advance !
Related
I noticed that my app sends icons to the Windows tray with a size of 16x16 pixels--and my Vista PC I've got a doublewide taskbar that appears to show icons at 18x18. The resizing artifacts on my app's icon look awful. How can I ask Windows what size the icons should be?
Edit
I'm generating the icon dynamically, with a pixel font text overlay. It seems wasteful to generate a bunch of icon sizes dynamically, so it would be nice to avoid building an icon with all the "possible" sizes (not that I'm even sure what those are).
GetSystemMetrics(SM_CXSMICON) returns 16--the incorrect value.
GetThemeBackgroundContentRect didn't help, either.
Create your icons in multiple formats, and let Windows select the one it wants.
Here's the Wikipedia article on the .ico format.
If you really need to know, GetSystemMetrics with a parameter of SM_CXICON or SM_CYICON will tell you the width and height that Windows wants to load.
Mark's core answer is the right one: Create your icons in multiple formats and let Windows choose the right one. Don't forget to do 32x32 and 64x64 icons for HighDPI scenarios.
But SM_CXICON/SM_CYICON won't necessarily return the size that will be used in the taskbar. The taskbar chooses the right icon size for it's size (this is much more important in Window 7).
Just provide appropriately sized icons and you should be ok.
Your best bet may be GetThemeBackgroundContentRect passing TBN_BACKGROUND as iPartId for the tray notify background.
GetThemeBackgroundContentRect should return the size defined by the current theme that may be used for drawing without overlapping the borders of the parent element. If I'm reading this correctly, that would be the largest sized notification icon permissible and presumably the size that is being used.
Testing with multiple DPI settings is probably the easiest way to tell if this is returning the correct value.
Per the NOTIFYICONDATA documentation:
If only a 16x16 pixel icon is provided, it is scaled to a larger size in a system set to a high dpi value. This can lead to an unattractive result. It is recommended that you provide both a 16x16 pixel icon and a 32x32 icon in your resource file. Use LoadIconMetric to ensure that the correct icon is loaded and scaled appropriately. See Remarks for a code example.
...
...
// Load the icon for high DPI.
LoadIconMetric(hInst, MAKEINTRESOURCE(IDI_SMALL), LIM_SMALL, &(nid.hIcon));
...
So, creating icons dynamically really isn't the best option. You should provide multiple icons of different sizes statically in your program resources and let Windows choose the best one it wants.
I've set my electron app icon by converting a 2014x1024 png to icns using this: https://github.com/bitboss-ca/png2icns
However, my icon looks every so slightly bigger than all the others in the "taskbar" on macOS (comes up when you cmd-tab).
Do I need to give my icon some sort of padding or something? How can I make it the same dimensions as other icons?
There doesn't seem to be any guidance on this, only on file formats and ideal dimensions (which I've adhered to already).
I am using DPro Rio 10.3 on an HP Spectre x360, which has a 4K display. The indicator on DbGrids and icons for DbNavigator controls scale fine at 1980 X 1080, but are almost invisible at 4K resolution. Text scales fine at any resolution.
I looked at the source code for both components and they contain methods which use LoadfromResource to load the appropriate graphic from the executable. TDbNavigator calls LoadfromResourse in a virtual method, SetButtonGlyph at runtime.
In addition, the DbGrid code seems to make an effort to scale the indicator in one of its methods. This, however, does not work, at least on my laptop.
FYI, I have set the form's Scaled property to TRUE. I have also tried several settings in the manifest, but none make a difference.
How can I fix this problem. Is it because these controls use a 16 x 16 graphic or is there some other cause? Is there a way to replace the graphics for each component with ones of higher resolution either in the executable resource file or programatically at runtime?
I stumbled across the answer from a post on the TMS Software website. In order to display properly on 4k screens, DPI awareness must be set to none. I tested this both in Rio and Tokyo, and it works. For Rio, you would select Project|Options and go to the Application section. Select Manifest and from the dropdown box for DPI Awareness, select None.
For Tokyo, also Project|Options, go to Application and uncheck Enable DPI.
Apple now require that a 1024x1024 icon is submitted for the App store. Where can I see an example of where this icon is used? The largest icon I can find in the iTunes store is about 180x180 - even on a retina screen, 360x360 would be sufficient.
I am putting some time into designing a large version of my icon, but if it is going to then be shrunk down, I need to design for this, no?
The large version of the icon is used to generate smaller versions for display in the app store and in other places that require icons in sizes other than the ones you submit. That way, if they need a version of your icon that's 162 px square, or 204 px square, or whatever, they have plenty of pixels in the larger version to ensure a reasonable rendition at smaller size.
Apple used to require a 512 x 512 px icon for this purpose -- sounds like they've doubled the resolution to support retina displays.
Remember, we're talking about a megapixel image here, not a 32 x 32 px tiny icon. When you're dealing with teensy icons, you do have to hand tweak each pixel to get the best approximation of the image you're trying to represent. When you're talking about scaling from 1024 px square to 360 px square, there shouldn't be a problem unless you've added some very fine detail at the large size. Don't do that.
You can find all the 1024x1024 png files in the source of the app's preview page.
Here's the trick:
Go to the app's page: https://itunes.apple.com/us/app/facebook-messenger/id454638411?mt=8
View Page Source (CTRL + U)
Find the "property="og:image" part. (CTRL + F)
<meta content="http://a4.mzstatic.com/us/r30/Purple/v4/c0/92/69/c09269c0-85ca-fd85-5f0f-f235dff13ff8/mzl.lyucgsnh.png" property="og:image" /
Copy the png's url, and paste in to the browser:
http://a4.mzstatic.com/us/r30/Purple/v4/c0/92/69/c09269c0-85ca-fd85-5f0f-f235dff13ff8/mzl.lyucgsnh.png
Voila! :)
From apple:
Starting in July, newly submitted iOS apps require high-resolution
icons and cover art. Large icons and Newsstand cover art must have a
minimum resolution of 1024 x 1024 pixels. To change your app icons or
cover art, go to the Manage Your Applications module on iTunes
Connect. For more information, see the Custom Icon and Image Creation
Guidelines in the iOS Developer Library.
As the largest right now would be the iPad 3 retina, the icon would be used for the AppStore large icon, which used to be 512 x 512, so double that for retina.
The 1024x1024 icons are for the app store according to tho iOS Human Interface Guidelines.. The table states that it is the:
App icon for the App Store
I guess it is for retina and promotion purposes. So Apple can make the large banners in the store and smaller icons out of it.
I've been working with a program someone else has made and I wanted to change the icon.
The icon I have is 256x256. I used http://converticon.com/ to create the icon (from a bmp I think). I used the icon in Inno Setup to create an installer and it worked fine
So I go to Options -> Application and attempt to load it. However, Delphi 2007 gives me an error 'The parameter is incorrect.' with this info: http://i.stack.imgur.com/vRCgs.png
When I do the same thing in Delphi XE, it works and loads the icon and changes it on compile. I can't use XE right now because the program uses a math parser that has a problem with unicode (thats something to fix for later haha)
So, what I did was open the project in XE, change the icon, save it, delete the dproj and open it in 2007. This works, compiles and displays the correct icon, but when I go to the project options, it gives me the same 'The parameter is incorrect' error.
The workaround isn't a big deal, but I shouldn't need to do it. Does anyone know why I can't change the icon in Delphi 2007?
Edit: I just used that same converticon site to convert the 256x256 icon to 192x192 and smaller and now it works perfectly. Thanks for the answers
The "icon" file is actually a collection of images, at different resolution and using different encodings. When I'm creating my icons I'm making sure they don't actually contain the 256x256 PNG-encoded version because development tools built before Windows Vista don't understand that. And that includes your Delphi 2007 and my Delphi 7. I also remove the alpha-encoded 256x256 icon because it simply makes the file needlessly large.
You've got two fixes possible:
Find an ICO editor and remove all of the larger formats until your Delphi accepts the icon. I personally never seen the 256x256 used in the real world, they'd take up huge amounts of space on user's Desktop or in Windows Explorer.
Use a dummy icon and replace the icon resource in the generated exe after Delphi is done with it. This way you can keep all of the larger image formats, including the 256x256 PNG image.
Edit to correct an error
If possible, always include the 256x256 image, Windows scales that down for everything above 64x64.
I always assumed Windows Explorer would show an image that's based on the closest matching image size available in the ICO. That is, if a 128x128 image is necessary, Windows would use the 128x128 image if available, or scale down the 256x256 image if that's available, or scale up the 96x96 image. Apparently that's not so. I've just made a test icon consisting of several image formats, including 32, 48, 72, 96, 128 and 256 consisting of simple blobs of color (using the flood-fill tool). In Windows Explorer I cycled throw the various Display Modes, and it became apparent that starting with "Large Icon" (and that's not very large) Windows will scale down the 256x256 icon, and if that's not available, use the 48x48 icon, unscaled! The result is truly ugly and unexpected. The 72x72, 96x96 and 128x128 icons were simply ignored.
Thank you David for pointing this out.
Older versions of Delphi don't support 256px Vista icons. I believe that 2010 does not support them so I guess the limitation was fixed in XE.
When working with an older Delphi you'll need to keep the 256px icon out of the IDE. You can still build an executable with a 256px icon from the command line compiler - I used to do just this before upgrading from Delphi 6. But to do this requires the use of a competent resource compiler, for example the Microsoft one.
2007 will let you select icons with a 256 pixel image. Here is what I tried:
The default icon for Delphi XE contains several image sizes, including a 256 pixel image.
If I extract the icon from a Delphi XE application using a resource editor, I can add that icon to a Delphi 2007 application using the IDE's project options. I don't get an error, and the icon images show as expected in Windows Vista/7 using Explorer at different sizes.
If I take the same icon that worked in Delphi 2007 and remove all of the image sizes other than the 256 pixel image using IcoFX, and try to select it again, then I get an error.
Try creating a .ico that includes other image sizes and see if that works for you.