|
"ARGB" would be four bytes, RGB three. 65635 should fit easily into a 32bit value, without loss.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hmm... well it appears that either you don't understand colorspaces and how color values work, or you didn't realize that I am trying to display the picture while working on it (which to me is a given). Doing what you suggest will not produce a grayscale picture as assigning a pixel in ARGB format the value of 65535 will give the G (green) channel a value of 255 and a blue channel value of 255 (making yellow) and an ARGB pixel value of 255 will give solid blue.
Furthermore, when .NET reads a 16bit grayscale picture, it DOES use the ARGB (specifically the 32bbpARGB) format and it DOES loose the data because it truncates the 16 bit value to an 8 bit value, losing the less significant bits (so 65535 is read as 255 and 255 is read as zero). You can find documentation about this issue all over the internet. It has the same effect as dividing the 16 bit values by 256. It then fills each of the color channels (RGB) with this 8 bit value so that they are all the same, giving a grayscale picture. Otherwise, you would not see a grayscale picture. If you then try to save the file, it will result in an 8bit grayscale picture. If you try using the 16bbpGrayscale pixel format and then try to save it, .NET throws an exception because 16 bit grayscale picture loading and saving are not supported by .NET (hence the need for this thread).
modified 23-Feb-18 16:53pm.
|
|
|
|
|
primem0ver wrote: Hmm... well it appears that either you don't understand colorspaces and how color values work, or you didn't realize that I am trying to display the picture while working on it (which to me is a given). Not much experience with manipulating the colormap, just curious
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
If GDI+ doesn't support the format, then there's nothing you can do with the System.Drawing assembly.
There are other libraries available, which might support the format. For example:
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks. I hadn't heard of SkiaSharp. I will look into them. I mentioned my problem with Magick.NET in the OP but it turns out that the link for the runtime is just hard to find. Apparently I don't have to compile Magick.NET myself (which I was unable to do because their format is for VS 2017... they don't have any downloads for earlier versions of VS).
As is, I have a working solution since I found the Magick.NET dll and while inefficient, I have a work-around. To clarify, I will probably still look into SkiaSharp for this, or future reference, as Magick.NET doesn't appear to have an efficient way of modifying pixel values directly.
|
|
|
|
|
|
I created a numeric up down control that can be placed in a toolstrip using the ToolStripControlHost. Now I want to be able to use it in designer. This article explains why it can't be done strictly using the ToolStripControlHost but it doesn't explain how to make it Designer compatible... at least not explicitly.
The problem is that I am already inheriting from ToolStripControlHost. As far as I know, c# does not allow inheriting from more than one class. So how do I make my ToolStripControlHost control Designer compatible? I have researched and found that there is a DocumentDesigner class that I could subclass and reference. However, I don't want this control to be added to the Toolbox. I only want it to show up on the ToolstripItem designer interface, so I am allowed to add it as shown in the example in the linked article (The "Month Calendar" in the dropdown for adding another control to the toolstrip). How would I do this?
|
|
|
|
|
Hi,
I have created a process that's runing a thread that open some windows form, now i want that other
running threads from the same process will be able to pass data to this windows form or even close it or reopen it.
The Windows form GUI is always in use of the end users so i cant lock.
what is the best way to implement it in c# ? i would like a short example, thanks.
|
|
|
|
|
|
Hello everybody,
I need to get the list of all the processes running in a Windows Embedded Compact 7 operating system.
My application is written in C# (Visual Studio 2008).
The problem is that the function System.Diagnostics.Process.GetProcesses() is not present in .NET Compact Framework and I don't know how to get the processes list.
Someone has some ideas on how to solve the problem?
Thank you in advance.
|
|
|
|
|
|
Thanks Eddy!
That's what I needed!
Unfortunately I had not found that article...
|
|
|
|
|
I am starting to work on a polygon library, whose side are bezier curves. The basic don't quite work yet so I can't really write stress / performance test program yet. nor show much code.
At any rate I have classes like that
public class BezierFragment
{
Point2D[] controlPoints;
}
public struct Point2D { public double X, Y; }
But I am wondering whether I should instead use struct (for less heap allocation and more stack copies)
public struct BezierFragment
{
byte order;
Point2D p0, p1, p2, p3;
}
public struct Point2D { public double X, Y; }
The later is much easier on the memory management, but might require more copy (of 65 bytes) struct. I wonder which one would be best.
How would I figure out the best option?
The (possible) memory management issues of the first choice might only be apparent when lots of Point2D[] array are saved in generation 2 memory pool and then destroyed...
Any tip?
modified 13-Feb-18 20:37pm.
|
|
|
|
|
Found that:
Choosing Between Class and Struct | Microsoft Docs
it says (one criteria for struct)
It has an instance size under 16 bytes.
if I use float for X, Y in Point2D, should be 33 bytes overall.... (or 36? with struct padding) might be too big...
|
|
|
|
|
This should only be a problem if you're using decimal.
A float pair should only be 8 bytes (plus anything else you have in the struct). You should even be able to scale up to a double pair and ride that limit line.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
I think the concern was the second version of BezierFragment , which has a byte plus four double pairs, all of which would be inline.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ugh, more coffee.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
How to add columns dynamically to wpf datagrid in MVVM without using dependency properties
|
|
|
|
|
|
Hi. I have a special software which only accept pointgray or ids camera.
They are industrial cameras and are very expensive.
industrial cameras are the same as webcam but with enhanced functionality.
Is it possible to write an application which can create a virtual industrial camera, and get photos from a webcam and feed it to that software? the only problem is that software does not accept any other cams except than IDS and pointgray.
|
|
|
|
|
Yes; they are called "simulators".
You create an API for the target camera.
You then create a simulator that mimics the camera's API.
You then either "connect" to the real camera or the simulator.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
In vb.net I can create an application to capture from a webcam using aforge.NET. But i need help to create a simulatir. I searched both ptgray and IDS websites for if there is any kind of simulator, but not found.
Can you guide me how to start to create a simulator?
|
|
|
|
|
How does one "communicate" with the "target" camera now?
What "SDKs" (Software Development Kits) does the vendor provide?
Are you the only one on this project? If so, set aside a few years.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
What are the best web designing trends to watch out in 2018?
|
|
|
|
|
Please don't repost if your message does not appear immediately: both of these went to moderation and required a human being to review them for publication. In order to prevent you being kicked off as a spammer, both had to be accepted, and then I have to clean up the spare. Have a little patience, please!
I've deleted the spare version.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|