views:

409

answers:

1

Hello!

For some reason if I call on a 600 dpi image:

myImage.SetResolution(72, 72)

It gives me "A generic error occurred in GDI+".

Moreover, if I try to create a new 72 dpi bitmap, create graphics object from that and use DrawImage to draw original 600 dpi image in the graphics object created from the new bitmap, I also get this error.

Can someone explain, please, what is going on?

Thanks.

+1  A: 

I don't have the reputation yet to post comments, but do you get the same error running this code:

Imports System.Drawing

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim oBitmap As Bitmap

        oBitmap = CType(Image.FromFile("c:\test.tif"), Bitmap)

        oBitmap.SetResolution(72, 72)

        oBitmap.Save("c:\test output.tif")

        oBitmap.Dispose()

    End Sub

End Class
Jacob Ewald
Thanks for the answer. Well, I think that depends on the actual file itself, so if you could send me the file, I'll try it. The only thing is that my problem was also with 600 dpi tif files. It's just that I thought it rather has to do with dpi settings not the image format, but may be I am wrong.
George
The tif I used was 600x600 DPI, I figured you would just replace the file path in the Image.FromFile call with the path to your 600 DPI tif.
Jacob Ewald