English 中文(简体)
带有指数化的六氯苯形式的图像书写文字
原标题:Write text to image with indexed pixel format

我有单方的森林论坛文件(1份),我想写一下案文。 当我把他们装入系统时。 引文。 图像,并试图从图像中播放一个图象物体,我收到错误,“不能因为有指数化的六氯苯形式的形象而制造图象物体”。

我可以将图像转换成非指数格式,如联合项目,但由此造成的图像规模很大。

I would like to accomplish this while keeping the image size down. How can I write text onto these images without converting them to another format?

最佳回答

采用汉斯·巴桑给的评论中的想法,我把这一条放在法典项目中:

改编该法典后,我将图像转换为32bpp,就这一形象撰写了文字,然后将其转换为1版。

问题回答

你们可以通过系统.Drawing.Bitmap.Clone转换图像。 这满足了小档案尺寸的要求。 如果你们需要一个双赢平台,则使用TiffBitmapEncoder。

Bitmap bmpTif = new Bitmap(imagePath);

Bitmap bmp = bmpTif.Clone(new Rectangle(0, 0, pageWidth, pageHeight),
    PixelFormat.Format32bppRgb);

Graphics g = Graphics.FromImage(bmp);

// Do your g.DrawString s

Bitmap bmpNew = bmp.Clone(new Rectangle(0, 0, pageWidth, pageHeight),
    PixelFormat.Format1bppIndexed);
bmpNew.Save(imagePath2);

http://imagemagick.codeplex.com/“rel=“nofollow” 图像Magick.NET,支持森林论坛的形象。 我认为,你可以采用“通知”方法,使案文成为案文。

希望这一帮助。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签