new Bitmap image with CMYK

The "duplicate" question explains how to change RGB to CMYK for a single value. I need to change an Image object and you can't convert it pixel by pixel, because you need a Bitmap object for it. If I change the Image object to Bitmap it's already converted, but with bad quality. I have been using the same resize method for jpg images for ages, but today I noticed that some i

带有CMYK的新位图图像

“重复”问题说明如何将RGB更改为CMYK以获取单个值。 我需要更改一个Image对象,并且不能逐个像素地对其进行转换,因为您需要一个Bitmap对象。 如果我将Image对象更改为Bitmap它已经被转换,但质量很差。 我一直使用相同的调整大小方法的JPG图像的年龄,但今天我注意到,一些图像质量非常差。 var newImage = new Bitmap(width, height); using (Graphics gr = Graphics.FromImage(newImage)) {

.NET test for bitonal TIFF image without trapping exception?

I am developing a document database application that handles TIFF images. When annotating images, in order for the user-interface to present only black and white as choices for bitonal (Format1bppIndexed) images versus multiple colors for images with a higher color depth I need to test for whether or not a TIFF is bitonal. Here is my function: private bool IsBitonal(string filePath) { bool

对于没有陷印异常的双色TIFF图像的.NET测试?

我正在开发处理TIFF图像的文档数据库应用程序。 当对图像进行注释时,为了让用户界面仅以黑色和白色作为双色(Format1bppIndexed)图像的选项,而对于颜色深度较高的图像则选择多种颜色,我需要测试TIFF是否是双色调。 这是我的功能: private bool IsBitonal(string filePath) { bool isBitonal = false; try { Bitmap bitmap = new Bitmap(sourceFilePath); Graphics graphics = Graphics.FromI

Image resize with GDI in .NET gives low saturation

I'm fighting an issue where my resized images looses color saturation when I manipulate them using GDI. I'm loading an JPG as original, resize it and the resulting image has a lot less saturation (color intensity) than the original picture. What can I do to improve that? this is my code: using ( var original = System.Drawing.Image.FromStream( new MemoryStream( image.RawData ) ) ) {

在.NET中使用GDI调整图像大小会降低饱和度

我正在处理一个问题,当我使用GDI处理它们时,调整大小的图像失去了颜色饱和度。 我以原始方式加载JPG,调整其大小,并且生成的图像的饱和度(颜色强度)比原始图片少很多。 我能做些什么来改善这一点? 这是我的代码: using ( var original = System.Drawing.Image.FromStream( new MemoryStream( image.RawData ) ) ) { using ( var dst = new Bitmap( width, height, PixelFormat.Format32bppArgb ) ) {

A generic error occurred in GDI+, JPEG Image to MemoryStream

This seems to be a bit of an infamous error all over the web. So much so that I have been unable to find an answer to my problem as my scenario doesn't fit. An exception gets thrown when I save the image to the stream. Weirdly this works perfectly with a png but gives the above error with jpg and gif which is rather confusing. Most similar problem out there relate to saving images to fi

在GDI +,JPEG Image到MemoryStream中发生了一般性错误

这似乎是整个网络上的一个臭名昭着的错误。 因为我的情况不适合,所以我一直无法找到我的问题的答案。 将图像保存到流中时会引发异常。 奇怪的是,这与PNG完美的结合,但给出了上述错误与JPG和GIF这是相当混乱。 那里的大部分类似问题都与将图像保存到没有权限的文件有关。 讽刺的是,解决方案是使用一个内存流,因为我正在做... public static byte[] ConvertImageToByteArray(Image imageToConvert) { using (var m

What can I use for good quality Code Coverage for C#/.NET?

I wonder what options there are for .net (or C# specifically) Code Coverage, especially in the Lower Priced segment? I am not looking for recommendations, but for a comparison of products based on facts. I know the following: NCover Seems to be very popular and looks quite good Supports statement coverage and branch coverage $480 for "NCover 3 Complete" Older Beta-Versions a

我可以使用什么来获得高质量的C#/ .NET代码覆盖率?

我想知道.net(或特别是C#)的代码覆盖率,尤其是在较低价格的细分市场中有哪些选择? 我不是在寻找建议,而是根据事实对产品进行比较。 我知道以下几点: NCover 似乎很受欢迎,看起来相当不错 支持报表覆盖和分支报道 “NCover 3 Complete”为480美元 较旧的Beta版本免费提供 Visual Studio(2008 Pro)| (2005年团队系统(开发,测试或团队套件版本)) 那么,这是微软所以我希望它能正常工作 完全集成到V

Bmp to jpg/png in C#

Is there any way to convert a bmp image to jpg/png without losing the quality in C#? Using Image class we can convert bmp to jpg but the quality of output image is very poor. Can we gain the quality level as good as an image converted to jpg using photoshop with highest quality? var qualityEncoder = Encoder.Quality; var quality = (long)<desired quality>; var ratio = new EncoderParameter(

Bmp到jpg / png在C#中

有没有办法将bmp图像转换为jpg / png而不会丢失C#中的质量? 使用Image类我们可以将bmp转换为jpg,但输出图像的质量非常差。 我们可以通过使用最高质量的photoshop将图像转换为jpg来获得质量水平吗? var qualityEncoder = Encoder.Quality; var quality = (long)<desired quality>; var ratio = new EncoderParameter(qualityEncoder, quality ); var codecParams = new EncoderParameters(1); codecParams.Param[0] =

C# OnPaint mousemove high cpu usage

I have written a custom control that renders some graphics. The graphics itself is fairly expensive to render but once rendered it rarely changes. The problem I have is that if you move the mouse really fast over the graphics surface it keeps calling the control's overridden Paint method which then incurs a high CPU penalty: private void UserControl1_Paint(object sender, PaintEventArgs e)

C#OnPaint mousemove使用较高的cpu

我写了一个自定义控件来渲染一些图形。 图形本身渲染起来相当昂贵,但一旦渲染它很少发生变化。 我遇到的问题是,如果将鼠标移动到图形表面上的速度非常快,它会一直调用控件的重写Paint方法,这会导致高CPU损失: private void UserControl1_Paint(object sender,PaintEventArgs e) 由于鼠标指针下面的图形/图像实际上并没有改变,所以可以使用什么技术来避免这种情况或最小化任何不必要的重绘? 编辑:看到你的编辑

proprietary Web Application to MVC3/Entity

I've posted a few questions over the months about structure of ASP.NET applications and Database-Abstraction-Layers, for the purposes of rewriting (from the ground-up), a legacy web application. I've recently stumbled on MVC3/Entity-Code-First and after spending some time with it, have fallen in love with how it works, how things are abstracted out, and I'm looking for any excuse to

专有的Web应用程序到MVC3 / Entity

为了重写(从头开始),我已经在几个月的时间里发布了一些关于ASP.NET应用程序和数据库抽象层结构的问题。 我最近偶然发现了MVC3 / Entity-Code-First,花了一些时间与之相恋,已经爱上了它的工作方式,如何抽象出事物,并且我正在寻找任何借口来使用它! 传统应用程序是一个C ++ / CLI窗口服务,它生成它自己的HTML(非常古老的HTML,CSS仅用于颜色和表格),并且界面与业务逻辑紧密耦合。 基本上,任何事情都会有所改善。

Parallel.ForEach with a custom TaskScheduler to prevent OutOfMemoryException

I am processing PDFs of vastly varying sizes (simple 2MB to high DPI scans of a few hundred MB) via a Parallel.ForEach and am occasionally getting to an OutOfMemoryException - understandably due to the process being 32 bit and the threads spawned by the Parallel.ForEach taking up an unknown amount of memory consuming work. Restricting MaxDegreeOfParallelism does work, though the throughput for

带有自定义TaskScheduler的Parallel.ForEach以防止OutOfMemoryException

我正在通过一个Parallel.ForEach处理大小各异的PDF(简单的2MB到几百MB的高DPI扫描),并且偶尔会发生OutOfMemoryException - 可以理解的是,由于进程是32位,并且线程产生了并行。对于每个占用未知量的内存消耗工作。 尽管限制MaxDegreeOfParallelism的确行得通,但当有大量(10k +)批次的小PDF使用时,吞吐量是不够的,因为可能会有更多的线程工作,因为所述线程的内存占用量小。 这是一个CPU繁重的过程,使用Parallel.Fo

Parallel Foreach slow creation of the threads

I have an IEnumerable with a lot of items that needs to be processed in parallel. The items are not CPU intensive. Ideally these items should be executed simultaneouslyon 100 threads or more. I've tried to do this with Parallel.ForEach(). That works, but the problem is that new threads are spawn too slowly. It takes a (too) long time before the Parallel.Foreach() reaches the 100 threads

并行Foreach缓慢创建线程

我有一个需要并行处理的很多项目的IEnumerable。 这些项目不是CPU密集型的。 理想情况下,这些项目应该同时执行100个或更多的线程。 我试图用Parallel.ForEach()来做到这一点。 这有效,但问题是新线程产生得太慢。 在Parallel.Foreach()达到100个线程之前需要很长时间。 我知道有一个MaxDegreeOfParallelism属性,但这是最大值,而不是最小值。 有没有办法在100个线程上立即执行foreach? ThreadPool.SetMinThrea