Convertig an image to an .ICO file without loosing color depth (and without installing additional utilities)? - vb.net

In a form I have an ImageList named MainLogoImageList containing a 100x100 pixel 32-bit colordepth image. That is my app logo.
I am too lazy to set up an icon editor and edit an icon of that logo, or convert the image to an .ICO file. (Ergh, well, I am not allowed to install custom utilities.)
To set my forms' icon, I use
Icon = IconFromImage(MainLogoImageList.Images(0))
in the OnLoad event handler to set the window icon.
In my about box, i have a PictureBox with no image. In its OnLoad event, I use
LogoPictureBox.Image = MyMainForm.MainLogoImageList.Images(0)
Icon = IconFromImage(MyMainForm.MainLogoImageList.Images(0))
to set the About box's icon and content.
So far, so good, the icon looks pretty good for a being created from a 100x100 pixel bitmap.
Is there an easy "no utility required" :-) way to get the icon that is returned my IconFromImage saved into an .ICO file so that it will keep the color depth when loaded as the app icon? I want to use exactly the icon that IconFromImage creates.
Saving it using
Dim S As New FileStream("MyAppIcon.ico", FileMode.Append, FileAccess.Write, FileShare.Write)
Icon.Save(S)
S.Close()
in the main form's OnLoad event handler and loading that .ICO file as the app icon in VS's project properties dialog yields and icon that is obviously converted to 16 colors, and looks awful.
This is VB 10 Express.

Followed the wise advide to take this home, edit and convert it there.
Gimp#home at work.
Worked fine, looks great.
A codeless solution is better than no solution at all :-)

Related

Image disappears in Microsoft Print to Pdf

I've developed a popup window and I use the body onload='window.print()' function to print the document, and then I choose the printer Microsoft Print to Pdf, which produces a PDF. However, the main logo I have at the top of the document goes missing. I have another website which uses the same approach with a different logo and that works fine.
I have attached the problematic logo below:
The image is a PNG. I originally used a transparent background, but I thought that maybe the PDF converter thinks the ratio of dark to light is too high and hides it, so I changed the background to white to increase the lightness ratio, but to no avail.
Is there something else I can do to force the logo to appear without the user having to tweak print configurations?

How to export specific portions of a psd or jpg file?

I have bought graphics from a graphics designer. He gave me a psd file with buttons and logos all in the same file. In the file there is a specific button I want to use for my project. How would I export only the button portion of the file to a png or jpeg?
using the eyeball toggle buttons on the right-hand panel, hide all elements you don't want
then go file > save as
give it a name and type of file you want to save as
What you can do in order to get just the single button or logo is something like what Miles said, but that might leave you with some extra blank space that you don't want.
Turn off all layers you don't want to save.
Select the crop tool and crop exactly what you want to save.
File - > Save for Web - > Select PNG or JPG and all other settings
Hope this helped!
here a little contribution :
calibrate your screen, check your color profile, turn you image in RGB mode or Grayscale (8 or 16 bit). ;)
Turn off layer you don't want to save, on windows shortcut "ALT+ left click" on layer eye you want to keep.
trim layer with menu/image/trim... Transparent Pixels
File / Save for Web / Select PNG-8 check transparency, click "Save..." choose a name and save button.
You can use shortcut for do it much more faster.
Of course you can make a Scripts in Scripts panel for repeat this action many times.
You can use free extension like cutandslice.me for export to different device in one shot.
Best wish.

Rotate PDF in VB.net forms with a button and save it afterwards

I am very new to managing PDF's in Vb.net, as for now I can open and view a PDF file in vb form.
the code goes like this:
OpenFileDialog1.ShowDialog()
AxAcroPDF1.src = OpenFileDialog1.FileName
But now I am stuck on how to rotate the view with a button. lets say I have 3 buttons 1 for clockwise rotation and the other for counterclockwise. And then I have a save button which saves the file to the rotated state. is this even possible?
I am using the adobe PDF reader in COM.
Short answer is no, not with the provided control. You need a third library to do this. The 3rd party controls work by creating a new image from the page you want to rotate and save that image as a new pdf page. Look into other pdf components to suit your needs. Most are not free, the good ones are pricey.
Here are some....
-iTextSharp
-PDFTron
-DynamicPDF
-PDFSharp

Setting a saved file's icon

I am making a custom file type, and I would like to have my application set the icon for the file without changing th icons of other files of the same type. Here is basically what I want users to go through to set the icon.
Open the application
Push a button (opens an NSOpenPanel)
Select an icon
Save the file
An alternative is to use my very simple, built in image editor. How can I accomplish this?
A good example is an image file. If you save an image from Photoshop, the file's icon is a miniature version of the image you saved. I want it to look and act just like that, if possible. Any ideas?
Edit: The file is supposed to save NSData. It is not actually an image file, but it includes the icon image.
Just use the setIcon:forFile:options: method of NSWorkspace, which will do exactly what you want.

application icon image doesn't show in taskbar in "small icon" setting

I have a vb.net 2008 application which has its corresponding icon.
The icon shows correctly except in the taskbar when the "small icon" setting is on.
My vb.net project includes a .ico file which when I see in the IDE includes 16x16, 32x32, 48x48, 64x64 and 256x256 bitmaps, in 4, 24 and 32 bits, also 3 .png images in 256x256 32 bits each.
I made the icon myself simply using a 64x64 bitmap and then converting it to .ico, and assigning it to the application in the project properties. I thought windows would use and escalate the corresponding image, it shows even in the file explorer properly in the small icon form, but not in the taskbar.
What's going on or what do I need to do? I'm not very familiar with this. Thanks...
You need to have the correct size/bit-depth version in your icon file for whatever context WinForms wanted (e.g. the form's title bar icon, the system tray icon, the taskbar
icon, or the desktop shortcut icon) to insure it will work. You have to maintain the transparency too.
Read the following article.