Problems resizing image

  • Thread starter Thread starter Colin Young
  • Start date Start date
C

Colin Young

I'm trying to rezive an image using the GetThumbnailImage method, and I'm
having some trouble with the GetThumbNailImageAbort delegate. It seems my
system doesn't think that
System.Drawing.Image.GetThumbNailImageAbort exists.

Any ideas? I think I've been staring at the computer for too long and I'm
missing something obvious because there's nothing in Google about other
people having this problem, and I know I've had this sort of code working
before.

Thanks

Colin
 
In theory it's needed but in practice it's never called because the current
version will never abort a thumbnail.

Just create a dummy thumbnail abort handler and pass that to the
GetThumbnailImage routine.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Image transition effects, automatic persistent configuration and
design time mouse operations all in April's issue of Well Formed
http://www.bobpowell.net/wellformed.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://royo.is-a-geek.com/siteFeeder/GetFeed.aspx?FeedId=41
 
Hi Colin,

Based on my understanding, you want to use GetThumbnailImage method, but
your program can not find GetThumbNailImageAbort delegate.

I am not sure why your program can not find the GetThumbNailImageAbort
delegate. GetThumbNailImageAbort should be in the same namespace with the
GetThumbnailImage method, also, they both belong to Image class, this
problem should not happen.

What error message do you get? Can you view the GetThumbNailImageAbort
delegate from the "Object Browser"? Also, you may try to use ILdasm.exe to
view the content of this System.Drawing.dll assembly, if
GetThumbNailImageAbort existed.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
The other issue aside, GetThumbNailImage is not a great way to resize
images. The method (as the name implies) is for creating thumbnails. If
you want to resize images, you should use the GDI+ call DrawImage on a
canvas that you created.

Pseudocode:

Bitmap bmp = new Bitmap(newWidth, newHeight);
Graphics gfx = Graphics.FromImage(bmp);
gfx.DrawImage(oldBitmap, 0, 0, newWidth, newHeight, 0, 0, oldWidth,
oldHeight);

-vJ
 
I can not view the delegate in the object browser. I get an error message
that GetThumbnailImageAbort cannot be found, are you missing an assembly or
reference (or something to that effect).

It turns out that I can just pass null as the delegate in the
GetThumbnailImage method call and that works, but I'm a little concerned
about the missing delegate problem. I am using VS.Net 2003 on a fairly fresh
system (brand new install about a month ago, never had previous versions of
VS.Net installed).

Colin
 
Thanks for the tip. I'll try that out. I haven't done a lot with images in
..Net, so I haven't come across that technique.

Colin
 
Hi Colin,

Thanks for your feedback.

I think your problem is very strange. Have you add System.Drawing.dll as
reference? On my machine, when viewing System.Drawing namespace, I can view
GetThumbnailImageAbort method.

Have you tried to use "Find Symbol" button of "Object Browser"? Actually,
in "Object Browser", GetThumbnailImageAbort method is not in the subtree of
Image class, so you should determine if it existed through "Find Symbol".

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Colin,

Does my reply make sense to you? Have you resolved your problem?

Please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top