Reply
Crop image to set Co-ordinates
Old 02-01-2007, 02:47 PM Crop image to set Co-ordinates
Average Talker

Posts: 25
Name: Ben Allen
Hi all,

I was just wondering if there was any way using ASP to crop an image to a number of co-ordinates. I'm pretty new to this ASP stuff, although understand enough PHP to help me out.

The only stuff I could find were scripts that you had to pay for.

Thanks
ballen is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 02-01-2007, 05:52 PM Re: Crop image to set Co-ordinates
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,025
Name: Forrest Croce
Location: Seattle, WA
Are you using ASP Classic, or ASP.NET?

If it's the latter, this is pretty easy to do with GDI+ using the graphics object, which you can instantiate with an image file.

If it's the former, you might be able to get at this functionality using Server.CreateObject?
ForrestCroce is online now
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 02-02-2007, 03:43 AM Re: Crop image to set Co-ordinates
Average Talker

Posts: 25
Name: Ben Allen
ASP.Net 2.0 i believe. I've seen this GDI+ mentioned on a few tutorials, but they all seemed to be in C#, which I'm unfamiliar with, and wasn't sure if there was another way.

Thanks
ballen is offline
Reply With Quote
View Public Profile
 
Old 02-03-2007, 02:52 AM Re: Crop image to set Co-ordinates
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,025
Name: Forrest Croce
Location: Seattle, WA
Well you could use GDI+ in VB if you prefer that language. Try some code like:

Dim g As Graphics = Graphics.FromFile("c:\images\1.jpg")
Dim img As Image = g.Clip(0, 0, 10, 10)
img.Save("c:\images\cache\1.jpg")

I haven't used GDI+ in a while, so that's probably a bit off, but if you use the help files ( or msdn.com ) you'll figure it out. The worst case is you can use getpixel/setpixel calls in two for loops ( x & y ), but there's a better way to do it ... I just can't remember what that is.
ForrestCroce is online now
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 02-04-2007, 05:37 AM Re: Crop image to set Co-ordinates
Average Talker

Posts: 25
Name: Ben Allen
Thanks. I managed to get it working by hacking up an example, but that's in C#, hopefully it won't be too hard to do something similar now in VB.

It used source and destination rectangles and stuff. That means its using x1, x2, width and height, but the javascript cropper I was using did output x2 and y2 aswell, so It might be easier to implement it your way.
ballen is offline
Reply With Quote
View Public Profile
 
Old 02-05-2007, 01:15 AM Re: Crop image to set Co-ordinates
saadatshah's Avatar
Extreme Talker

Posts: 216
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Use this link to covert the C# code to VB.NET

http://www.developerfusion.co.uk/Uti...sharptovb.aspx
__________________
Traffic School - Driver Ed - Defensive Driving - Texas Defensive Driving - Online Traffic School - Defensive Driving Course
If you have knowledge, let others light their candles in it.
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Reply     « Reply to Crop image to set Co-ordinates
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14509 seconds with 13 queries