Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 81032

This tag is for questions related to the loading, formatting, saving, compression, and display of data representing pictures.

4 votes
1 answer
17k views

Convert an image to 8-bit color

I have a function that will take an image and then return that image in 8-bit color. Almost all of the code was taken from MSDN. … private static Image ImageTo8bpp(Image image) { var bitmap = new Bitmap(image); var imageCodecInfo = GetEncoderInfo("image/tiff"); var encoder = Encoder.ColorDepth; var encoderParameters …
Owen's user avatar
  • 1,494
2 votes
1 answer
3k views

Pixelate image with average cell color

I wrote a function that will pixelate an image using the average color of each 4x4 cell. … private static Image PixelateImage(Image image) { var bitmap = new Bitmap(image.Width, image.Height); using (var graphics = Graphics.FromImage(bitmap)) { graphics.DrawImage(image, new …
Owen's user avatar
  • 1,494
16 votes
6 answers
18k views

Determine if an image is opaque or transparent

I wrote an extension method defined for the Image Class (System.Drawing) — which returns a Boolean value telling you if the image is opaque or transparent. … public static bool IsOpaque(this Image image) { var bitmap = new Bitmap(image); var bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly …
Owen's user avatar
  • 1,494
5 votes
1 answer
8k views

Generate video thumbnail

Then, it obtains the video file's duration, stores the middle frame, and writes it to an image file. … Finally, it retrieves the image file bytes and returns them ... after deleting the video & image file. How can I make it more efficient? …
Owen's user avatar
  • 1,494
5 votes
4 answers
13k views

Get the brightest rectangle within an image

I wrote an extension method for bitmaps which finds the brightest rectangle (with specified width & height) within an image. Hopefully my code comments eliminate any confusion. …
Owen's user avatar
  • 1,494