jpg to tiff

  • Thread starter Thread starter Lee McKnight
  • Start date Start date
L

Lee McKnight

I need to be able to convert a JPG (or bmp, gif) to a TIF image in C#.

Here's the kicker...

I can't use GDI+, because this code will be running as a windows
service, and it can't have access to the desktop.

Is there any other way to accomplish this?

Thanks.

Lee
 
I need to be able to convert a JPG (or bmp, gif) to a TIF image in C#.

Here's the kicker...

I can't use GDI+, because this code will be running as a windows
service, and it can't have access to the desktop.

I think you should be okay using the Image class. Load one image and
then do a Save:

img.Save(file, ImageFormat.Tiff);
 
Thanks for your reply.

I have tried this in the past, and it works fine in a windows form
application, but I get an error when this code executes in a windows
service. After some investigation, it seems that

img.Save(file, ImageFormat.Tiff);

actually creates a hidden window in the background to do the image
manipulation. Since a windows service can't have access to the
desktop (setting it to run as local system account is not an option in
my case), this line of code fails with the following message:

'The type initialize for "System.Drawing.SafeNativeMethods" threw and
exception.'

So, I need a method to save these image formats to TIFF that falls
outside these Image functions. Does anybody have any ideas?


Thanks,
Lee
 
Back
Top