I import background image to every forms in my project now my programs runs slow?
How can I fix this?
the format for the image is png.
Any things to consider in to doing this? to solve the issue? thanks!
In your Form,set property DoubleBuffered to true
Buffered graphics require that the updated graphics data is first
written to a buffer. The data in the graphics buffer is then quickly
written to displayed surface memory. The relatively quick switch of
the displayed graphics memory typically reduces the flicker that can
otherwise occur.
Instead of using PNG format use JPEG format with Quality 12(final image quality is like PNG format),your image size decrease and your form load faster.
Related
I'm using the ImageResizer .net library. It works as expected, but one image messes around.
I've uploaded the image below. I've already tried some things like format=jpg&quality=100, only width=220, also different sizes, but it always adds this blurry border around the image.
The original image is a png.
This one is the original image:
This one is resized by the ImageResizer:
And this one is resized with photoshop:
EDIT:
If you're running into the same issue. Try to set up the SpeedOrQuality Plugin. I've set it to speed=3 and the image is sharp again.
Vector graphics require different resampling algorithms than photographs.
ImageResizer V4 includes higher quality image resampling options under the FastScaling plugin.
For graphics (non-photographic images), I suggest playing with &f.sharpen=0..100, &down.preserve=-5..5, and &down.filter=Robidoux. Make sure &fastscale=true and FastScaling is installed.
You can certainly find a good configuration for your rasterized vector art and set up a preset for it. FastScaling is capable of much better resampling than Photoshop - on par with Lightroom, in fact.
Enabling fastscaling alone helps substantially (?width=200&fastscale=true):
Adding sharpening gives a very clear result: (?width=220&fastscale=true&f.sharpen=100):
Visibly crisper than Photoshop:
Each time you save a jpeg, you loose quality (the image is reencoded).
I would recommend using the same quality as the original image was save against, it should give the best results.
Using a higher quality is not recommended as it will artificially try to improve quality, mistaking approximations done by previous encoding for details, resulting in things like the blurry border.
Aside that, usually, one should not use a quality over 95 for jpeg encoding.
I am working on a CMS like project which users can upload images with contents. I have to create thumbnails for the uploaded images on the fly. Lets say the thumbnail size as 125x75
I can resize images without problem but when it comes to crop operation several problems occur. My resize and crop procedure works like this:
Load the original image.
Resize the image to desired size preventing the original aspect ratio depending on the given maximum width or height
If the result image has a different aspect ration than the output aspect ratio than a centered crop operation is applied.
But what I want to achive is a content-aware cropping as described in Jue Wang's article Opticrop: Content-aware Cropping with PHP and ImageMagick
Is there any way to do it with C# or is there a library that can do this operation.
Note: I do not want content-aware resizing. Content-aware resizing (seam craving) can be done with ImageResizing.net SeamCarving plugin
If you are using the ImageResizing.net framework, the WhitespaceTrimmer plugin may be a good starting point I think.
If you want to write the code yourself, this Gist shows a good solution using entropy but is written in Ruby.
I am working on fixing a problem in a program (ReportGenerator) which seems to be an issue with the printed report, either being extremely poor quality or much too large.
This project involves the use of two threads that synchronize the task of preparing the pages for preview and printing them. The start points for these two threads are preventing me from using PrintPageEventArg (an input of PrintDocument_PrintPage) at the proper time in order to use e.graphics that can improve the print quality. To try and work around this issue I created a graphic from a bitmap (graphics.FromImage(bitmap)) but this creates its own problems. In order to use this event I must change the start points for the threads causing even further problems. I have a limited time and I cannot take the time to completely re-write this project. Are there any suggestions as to what I may be able to try in order to find a workaround?
This is a general overview of the project, including the threads and my methods:
Print Show Dialog -> ok
Print_Document_BeginPrint -> Thread begins here
3.Create a graphic from bitmap(graphics.FromImage(bitmap))
From here if I could use PrintPageEventArg my issues would be solved but I am not that lucky
Alternatively I could create a bitmap and draw a prepared graphic on it (graphics.Draw(..bitmap...)) saving this image on the system and then restoring it in PrintDocument_PrintPage ,This method allows me to use PrintPageEventArg but only after I restore the previously created graphics and print them.
I have asked questions related to this problem before on these links.
how to improve printed text quality after using "graphics.DrawString"?
save an image as a bitmap without losing quality
Any help would be greatly appreciated. Thanks in advance.
Confusing.
Why don't you draw into the Graphics created from printer HDC? If you draw into a bitmap Graphics first, the bitmap needs to be of high resulition (e.g. 300-dpi) to get better printing quality. But printing could be slow due to sending large amount of image to printer.
I'm working on a timelapse application and that requires drawing new frame every 30ms. Frames are stored in isolated storage (they are 640x480).
I tried loading them into MemoryStream first, and then convert to BitmapImage and assign as a Source for the Image control. But it's too long - it takes about 55ms. I measured and it's not reading from isolated storage, it's actually loading image into Image control that take the longest.
Is there any way to draw images faster on windows phone with silverlight or should I consider doing so with XNA?
Take a look at the WriteableBitmap class and the open source library WritableBitmapEx. The Blit method within WriteableBitmapEx will copy one bitmap into another. Not sure if it's fast enough for what you need, but it is very fast for what I'm doing with it.
Is there any predefined control in WPF or VS2010 to implement the Image Zooming functionality (like Googlemaps) for a bitmap displayed over a panel using C#? My bitmap will be minimum 8GB in Size.
Thanks in advance
Murali
There is DeepZoom for Silvelight. There is no such thing in WPF. It was planned for WPF4, but removed before RTM.
Update:
Loading images of this size is pretty uncommon. You should consider tiling as others suggested. Also consider if you really need load all data at once. If the image has size of for example 30000x30000 then the user do not really need/can't to see all this data. Use tiling and appropriate image format (jpg etc) for each zoom level.
Relevant links:
Single objects still limited to 2 GB in size in CLR 4.0?
Pushing the Limits of Windows: Physical Memory