Archive for the ‘Image’ category

Cool OSX tip of the day.

January 25th, 2013

I do a lot of video editing with my mac and whenever I create a video for upload on the web I always need a still image for the preview image in the jwPlayer I use on the web. I used to have to have some kind of program to grab the still and export it for me, not anymore. This functionality is built right into OSX, all you simply have to do is do a SHIFT-COMMAND-4 and it will bring up a crosshairs and allow you to select the item you would like to capture and immediately turn that into a png file and place it on your desktop, how cool is that?

How to resolve issues with embedded images in email.

May 10th, 2012

I am embedding an image into an email that the server is generating using the SmtpClient in .net and I was having an issue with it caching images in certain situations and then Internet Explorer wouldn’t display the images at all, which is probably a security feature of IE, but the images did show up in Firefox and Chrome. Anyways, here is the code below that will make all of it work correctly in IE and should always show the images correctly, it generates a new Guid to always have a unique image Id so that caching won’t happen and then also tells the client that the ContentType is a jpeg which apparently IE needs to display the image correctly.

Guid contentId = Guid.NewGuid().ToString();

AlternateView htmlView = AlternateView.CreateAlternateViewFromString(
  "This is a sample JPG embedded image<br><img src="cid:" + contentId + "">", 
  null, "text/html");

ContentType ct = new ContentType(MediaTypeNames.Image.Jpeg);

LinkedResource EmbeddedObjects1 = new LinkedResource("PathToImage\image1.jpg", ct);
EmbeddedObjects1.ContentId = contentId;

A generic error occurred in GDI+.

April 13th, 2012

Are you getting this error when you try to save an Image to your disk somewhere?  I was getting this very “Generic” error when I was trying to write a Bitmap out to my hard drive using Windows 7.  I was just trying to write it to C:\temp\test.bmp and it was throwing this error up which didn’t tell me a thing.  It turns out that the error is masking the real error, which looks to be some kind of permissions error, so if you just change it to either save it to another drive or even another folder, this error should go away.  I hope this helps someone else out there struggling with this issue.