Paint3D | program allowing painting textures of different channels | 3D Animation library
kandi X-RAY | Paint3D Summary
kandi X-RAY | Paint3D Summary
A program allowing painting textures of different channels SIMULTANEOUSLY on a 3d model. You can also see this page:
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Paint3D
Paint3D Key Features
Paint3D Examples and Code Snippets
Community Discussions
Trending Discussions on Paint3D
QUESTION
I wrote some code to create ico files from any png, jpg, etc. images. The icons seem to be getting created correctly, and looks almost like the original image, when opened in Paint3d. Here is how it looks:
But when setting the image as a thumbnail to a folder, it looks weird and shiny.
Here is how it looks in windows file explorer:
Firstly, I would like to know if this is an issue in Windows itself, or is it code related? If this is Windows related, the code doesn't matter. If not, here it is:
I picked up a couple of code snippets from across the internet, so probably some non-optimized code, but here is the meat of my code:
...ANSWER
Answered 2020-Jul-29 at 11:30The differences in scaling are the result of the fact you're not doing the scaling yourself.
The icon format technically only supports images up to 256x256. You have code to make a square image out of the given input, but you never resize it to 256x256, meaning you end up with an icon file in which the header says the image is 256x256, but which is really a lot larger. This is against the format specs, so you are creating a technically corrupted ico file. The strange differences you're seeing are a result of different downscaling methods the OS is using in different situations to remedy this situation.
So the solution is simple: resize the image to 256x256 before putting it into the icon.
If you want more control over any smaller display sizes for the icon, you can add code to resize it to a number of classic used formats, like 16x16, 32x32, 64x64 and 128x128, and put them all in an icon file together. I have written an answer to another question that details the process of putting multiple images into a single icon:
A: Combine System.Drawing.Bitmap[] -> Icon
There are quite a few other oddities in your code, though:
- I see no reason to save your in-between image as png file. That whole
fs1
stream serves no purpose at all. You never use or load the temp file; you just keep using theb
variable, which does not need anything written to disk. - There is no point in first making the icon in a
MemoryStream
, then loading that asIcon
class through its file loading function, and then saving that to a file. You can just write the contents of that stream straight to a file, or, heck, use aFileStream
right away. - As I noted in the comments,
Bitmap
is a disposable class, so any bitmap objects you create should be put inusing
statements as well.
The adapted loading code, with the temp png writing removed, and the using
statements and resizes added:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Paint3D
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page