Solved

Plug-in for dealing with graphics in VB.net

Posted on 2004-10-17
9
447 Views
Last Modified: 2011-09-20
I am a VB.net programmer.  I am writing an app that needs to resize pics, resample resolution, maybe adjust brightness / contrast and convert to and from different picture formats.  I hate dealing with the code to deal with pictures and graphics, it is confusing.  I was wondering if anyone knew of a plug-in that does this kind of image work automatically?

Thanks so much.
0
Comment
Question by:hunterdnance
  • 3
  • 3
  • 2
9 Comments
 
LVL 1

Expert Comment

by:liads
Comment Utility
You're in great luck! The .NET framework has got a built-in graphics handling library.
Check the System.Drawing namespace.
I've come across this code a while ago, but haven't got the time to test it yet.
Anyway, the following example should return a resized image.

<%@ Page Language="vb" Debug="True" %>
<%@ import namespace="System" %>
<%@ import namespace="System.Drawing" %>
<%@ import namespace="System.Drawing.Imaging" %>
<%@ import namespace="System.IO" %>
<script runat="server">

Sub CreateThumb()

  dim graphic as System.Drawing.Image = System.Drawing.Image.FromFile(request("Image"))
  dim graphicFormat = graphic.rawformat
  dim Image as New Bitmap(graphic, cint(request("Width")), cint(request("Height")))

  if graphicFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif) then
    Response.ContentType = "image/gif"
  elseif graphicFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg) then
    Response.ContentType = "image/jpeg"
  elseif graphicFormat.Equals(System.Drawing.Imaging.ImageFormat.Png) then
    Response.ContentType = "image/png"
  elseif graphicFormat.Equals(System.Drawing.Imaging.ImageFormat.Bmp) then
    Response.ContentType = "image/bmp"
  end if

  Image.Save(Response.OutputStream, graphicFormat)

  graphic.Dispose()
  Image.Dispose()

End Sub
</script>

<% CreateThumb() %>
0
 
LVL 16

Expert Comment

by:OliWarner
Comment Utility
GDI+ is already in .net and can already do everything you need.

Its in the drawing package of .net look in the MS API for information and code samples.


>> I hate dealing with the code to deal with pictures

Just read that bit. There's a fair bit of coding :\
0
 

Author Comment

by:hunterdnance
Comment Utility
Ok the code you guys have posted is what I am trying to avoid.  My question; is there a plug-in (like a toolbox control) that does this.  For instance:

plugin1.image.resize.percent(50)
plugin1.image.format.convertTo(bitmap)
plugin1.image.colors.depth(grayscale)


See how simple?  May be a fantasy of mine, but if you want the points give me a simple yes or no if a plugin control like that exsists.

Thanks and sorry for the trouble.
0
 
LVL 1

Expert Comment

by:liads
Comment Utility
I was looking for a COM component to do so for my asp pages.
I found several, but all of them required payment, and some are really not cheap.

I can post the list from my bookmarks, if you're still interested in them.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:hunterdnance
Comment Utility
I have a $3,000 expense budget for this prototype.....Money is of no object, haha.

I am awarding you the points, please list the bookmarks and your suggestion on which one is best.

Thanks.
0
 
LVL 16

Expert Comment

by:OliWarner
Comment Utility
dude, dont allocate points for non-answers


even if money IS no object, writing something a) doesnt take that long and b) will probably be better optimised for what you want...

It doesnt often make a lot of sense to just throw money at a problem.
0
 
LVL 1

Accepted Solution

by:
liads earned 500 total points
Comment Utility
Thanks !

I'm giving you the links to a directory full of these components. And hey, it seems there're ASP.NET controls there as well :)

For ASP components:
http://www.aspin.com/home/components/graphics

For ASP.NET controls:
http://www.411asp.net/home/assembly/graphics

Check out their 'related categories'. There are more relevant categories there.

From my searches, I was most impressed with AspJpeg (http://www.aspjpeg.com).
Not because I could actually use it, but because it's the most popular among asp programmers for such tasks. (and seems easy enough to use)

Enjoy :)
0
 

Author Comment

by:hunterdnance
Comment Utility
Admin:  Won't happen again, sorry for the inconvience. -Hunter
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mapShare challenge 13 67
groovy example issue 10 65
What is Python programming? 3 62
C# code editing and collaboration 3 39
Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This is an explanation of a simple data model to help parse a JSON feed
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now