imaging

Printing a WPF BitmapImage

你。 提交于 2019-12-10 14:14:17
问题 What's the best way to print a BitmapImage? I come from a background in System.Drawing so I was thinking about converting it to a Bitmap and then printing it, but I'm thinking there's probably a better way. Thanks! 回答1: Building upon Drew's answer, it is best to measure and arrange the container that is handed to the PrintVisual method. This will prevent an image that is larger than a 8.5 x 11 sheet of paper from being cut off. Here is an example of how I printed an image that was partially

32bit rgb bmp to 24bit rgb bmp in C# problem

☆樱花仙子☆ 提交于 2019-12-10 12:06:20
问题 I have to convert 32bit rgb bmp images in to 24 bits rgb bmp. This is what i am trying to do Bitmap b1=new Bitmap(sorecFileName); Bitmap b2=new Bitmap(b1.Size.Width,b1.Size.Height,System.Drawing.Imaging.PixelFormat.Format24bppRgb); b2.SetResolution(b1.HorizontalResolution, b1.VerticalResolution); Graphics g=Graphics.FromImage(b2); g.DrawImage(b1,0,0); //continue to draw on g here to add text or graphics. g.Dispose(); b2.Save(destinationFileName); The code compiles fine and generates the

OCR engines designed for screen-reading

安稳与你 提交于 2019-12-09 16:32:34
问题 Are there any OCR engines designed for identifying text in screen-captured images rather than scanned text? I have a project where I need to retrieve and identify text in an application, and none of the OCR engines I've tried so far have faired well with screenshots. Ideally the engine should work well with color and with background noise, although I can make some allowances if nothing like that is available. It will need to be .NET compatible; either written in .NET or having a .NET-callable

OpenCV grouping white pixels

杀马特。学长 韩版系。学妹 提交于 2019-12-09 12:15:36
问题 I've done the hard work, turning my iSight camera on my MacBook into an infrared camera, converted it, set the threshold etc.. and now have an image that looks something like this: alt text My problem is now; I need to know how many blobs are on my image by grouping the white pixels. I don't want to use cvBlob / cvBlobsLib , I'd rather just use what is already in OpenCV. I can loop through the pixels and group them by checking for (thresholded) touching white pixels, but I'm guessing there is

How can I get the depth of a jpg file?

南楼画角 提交于 2019-12-08 19:18:38
问题 I want to retrieve the bit depth for a jpeg file using Python. Using the Python Imaging Library: import Image data = Image.open('file.jpg') print data.depth However, this gives me a depth of 8 for an obviously 24-bit image. Am I doing something wrong? Is there some way to do it with pure Python code? Thanks in advance. Edit: It's data.bits not data.depth. 回答1: I don't see the depth attribute documented anywhere in the Python Imaging Library handbook. However, it looks like only a limited

How to convert a image file loaded in memory to a ID2D1Bitmap in C++

烈酒焚心 提交于 2019-12-08 04:50:36
问题 I'm trying to convert a image file (a png, but could be anything) that I just extracted into memory from a compressed file to a ID2D1Bitmap to draw using Direct 2D. I tried to look for some documentation, but I can only find methods that receive "const char* path" or ask me width and height of my image, that I can't know before-hand. Searching on google for it got me nowhere. The file is raw in memory, and I would like to avoid to extract images to the hdd into a temporary file just to read

Create a Bigtiff (>4GB) File with Bitmiracle Libtiff.net

♀尐吖头ヾ 提交于 2019-12-07 18:30:01
问题 First I want to thank Bitmiracle for this great lib. Even while creating very big files, the memory footprint is very low. A few days ago I ran into a problem where I wanted to create a tiff file bigger than 4GB. I created the tiled tiff file successfully, but it seems that the color of the tiles created beyond 4GB are somehow inverted. Here the code relevant code: Usage: WriteTiledTiff("bigtiff.tiff",BitmapSourceFromBrush(new RadialGradientBrush(Colors.Aqua,Colors.Red), 256)); Methods:

How to draw unicode characters on transparent image in PIL

和自甴很熟 提交于 2019-12-07 16:48:29
问题 I am trying to draw certain unicode characters on and image using python (PIL to be precise). Using the following code I can generate the images with a white background: ('entity_code' is passed in to the method) size = self.font.getsize(entity_code) im = Image.new("RGBA", size, (255,255,255)) draw = ImageDraw.Draw(im) draw.text((0,6), entity_code, font=self.font, fill=(0,0,0)) del draw img_buffer = StringIO() im.save(img_buffer, format="PNG") I tried the following: ('entity_code' is passed

Storage Commitment Service: why I really need a what is the real purpose?

☆樱花仙子☆ 提交于 2019-12-07 11:03:50
问题 I'm wondering why I really need of commitment after a c-store command; I can understand the commit is a sort of assurance about the fact the message was actually taken in charge by the storage and the storage takes the responsibility of it, but I wonder why is not safe enough to rely on the response status ? I read some explanations about that but none convinced me all the way. As far as I understood a commit can be required or better desirable basically because you can not totally trust the

WIA 2.0 Duplex property

放肆的年华 提交于 2019-12-07 08:10:53
问题 I am developing an aplication with C# to use the WIA 2.0 library. At the moment I could use most of the features, such as ADF (auto document feeder), filters and more. Now, I need to use the duplexer of my scanner (fujitsu). I'm trying to set the WIA_DPS_DOCUMENT_HANDLING_SELECT scanner property to the DUPLEX value. See the code below: try { bool hasMorePages = false; //determine if there are any more pages waiting Property documentHandlingSelect = null; Property documentHandlingStatus = null