Best image format for tray icon - java

I created a Java application with tray icon. I am using a transparent png image. However, the rendered icon is very ugly on all platforms, including Windows 7 and Linux.
Are there any good practices for creating tray icons (e.g. format, size, etc.)?

In windows, you should use the .ico format. It may contain multiple icons with different sizes.
In Linux I guess png is the standard. Just don't try to scale it. Pre-create multiple versions of the same image with different sizes.

There is no "known solution" for this problem as far as i know. You should switch your transparent icons to square ones. You can check this question for deeper information;
java TrayIcon using image with transparent background

Related

Can we bypass HiDPI UI scaling when rendering high-res RenderedImages in Java 9+

I am working on a medical image viewer, and would like to take advantage of the HiDPI scaling options offered by Java since Java 9. I like that Java/Swing is not able to properly scale up fonts, layouts, and various UI elements, but as has been lamented in multiple posts in here, doesn't automatically do a good job with bitmaps, displaying icons and images in a very pixelated way.
I have seen several questions and answers in here about how to deal with badly scaled up icons. This is not what this is about.
My question is about displaying and interacting with high-resolution images without having them scaled up while rendering, when everything else in the UI is being scaled up. I don't want to turn off HiDPI scaling altogether, I want to use it for the UI.
Is there a way to selectively display RenderedImages in screen resolution, bypassing the scaling?
I took me a while digging through a lot of unrelated or tangentially related topics, but I did eventually find an answer to my own question here:
jdk 9 high dpi disable for specific panel

When I add a JPG image in Codename One resource browser, it breaks

I have an image of rather large resolution (9332 x 5116). When I go to the codename one editor, to add image, I can add the image, but then when I get back into the editor, the left-side menu doesn't display properly. To be more specific, it doesn't redraw when I'm in the Multi-image or All Images menu. The only way to go back to normal is to do a "Delete unused images."
Is this a known issue? I'd hate to sacrifice image quality.
Any advice greatly appreciated.
Thanks.
The image is WAY too big to fit into any device and would crash many devices when they try to open it. The designer wasn't built to handle images so large, you can run it with more RAM but the solution is to use an image of realistic size.

Image Sizes for Themes

I'm looking at making my own theme in CodenameOne but I cant find out quite what I need to do (I should point out I'm new to codename one)
From what I can see the key to what I need to do revolves around Multi-Images. I place an image there and the designer scales it multiple times so that I have all the images needed for the multitude of devices. Clearly, if it's scaling, the exact size of the image I put in Multi Image is a little irrelevant but what is the optimum size (presumably the close to the largest dimensions that will be used?). Can anyone give me an idea about the resolution of, say, a background image that I'm going to put into Multi Image and the correct (or best) aspect ratio?
Historically we recommended making retina iPhone sized images then importing them using the "Quick Add Multi Image" menu option and picking "Very High" as the target DPI.
This still works rather well but recently there has been an influx of higher DPI devices (iPhone 6+ and newer Android flagships) so we might update that guideline in the near future.

button in PSD as multiple layers into mobile code java

A PSD file i'm working with has its icons designed IN PSD using layers that are a result of using magic wand, rectangle tool, circle tools etc.
For example, an icon can be made up of 4 different layers in 1 photoshop folder (ie using magic wand 2x, rectangle tool 1x, circle tool 1x)
I understand that if an icon in PSD were to be usable in code it should be in jpeg, png format, please correct me if I'm wrong as I'm new to this.
You are absolutely correct to be usable it should be either png or jpeg(there are others too). Png and 9 patch png are preferred in android. You can find more about it on the developers website.

What kind of image formats should I use in an Android application?

I'm writing a game for Android and I was wondering what kind of images should I use for the in game graphics.
I told the customer to create the artwork in the highest possible (and reasonable) resolution and I will scale it down but I have been told lately that SVG would be better than plain PNG for example since there are a lot of resolutions used by Android devices and the images have to be scaled. Most of the graphics will be stationary backgorunds or objects but there will be some animations. I will use AnimationDrawable for this.
Is there some general guideline for graphical file formats (I checked out android developer site but didn't find anything) or just go with whatever I have at the moment?
I have been told lately that SVG would be better than plain PNG for example
Android does not support SVG natively. There are third-party libraries that support SVG, such as this one.
since there are a lot of resolutions used by Android devices and the images have to be scaled
If that is literally what your graphic designer told you, you need to hire a different graphic designer. Quickly.
Resolution is typically meaningless. What matters is screen size and, more importantly for graphics, screen density. Android supports multiple versions of an image for different densities, and can also resample images from one density into another, so you can "dial in" how many densities you wish to support directly. Here is a blog post from yesterday regarding screen density, and there is plenty of material in the Android documentation on this as well.
Now, your graphic designer might use SVG "internally" and generate density-scaled PNG files for your use -- that is perfectly reasonable.
Is there some general guideline for graphical file formats
Yes, here. It says
Android supports bitmap files in a three formats: .png (preferred), .jpg (acceptable), .gif (discouraged).
There is no native support for SVG drawables but there are libraries that support SVG
See SVG support on Android
You would typically convert SVG images to pixel images for each density. Android also defines some standard sizes for icons like Menu icons
Having the sources for the images you use as SVG is not a bad idea. SVG and other vector based graphics usually scale better to different sizes than pixel graphics. Especially if you need to enlarge an image (for example for the hi-res icons used in the Play store).
Also be careful with AnimationDrawable, it is not meant to be used for fullscreen animations. Just small animated icons and such.

Categories