views:

31

answers:

1

Hi everyone

As a follow up to this thread

I found that the overlay function was working fine. However, it seems that if I use the overlay function while reading an image from a stream, that it would enlarge the picture before overlaying it.

ie:

overlay = New Bitmap(stream)
g.DrawImage(overlay, 0, 0)

Seems to enlarge the image before overlaying it, whereas this:

overlay = New Bitmap(My.Resources.Pic)
g.DrawImage(overlay, 0, 0)

Seems to overlay the image fine.

What could be the reason for this?

A: 

It's possible that there is a DPI mismatch that GDI+ is attempting to compensate for.

Right-click on the My.Resources.Pic and choose "Goto Declaration". You should be able to locate the line of generated code that loads it. You can compare that code against how you load the image to see if there are any differences.

Frank Krueger
Hi!Would this be the case even though the images have the same dimensions?If so, what would be the correct way of accounting for that?
Also, I forgot to add that in the example I posted above, the image read from the stream and the image defined directly through the resources are identical.