Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



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

Posts: 28
Name: Ben Allen
Trades: 0
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
 
 
Register now for full access!
Old 02-01-2007, 06:52 PM Re: Crop image to set Co-ordinates
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
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?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 02-02-2007, 04:43 AM Re: Crop image to set Co-ordinates
Average Talker

Posts: 28
Name: Ben Allen
Trades: 0
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, 03:52 AM Re: Crop image to set Co-ordinates
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 02-04-2007, 06:37 AM Re: Crop image to set Co-ordinates
Average Talker

Posts: 28
Name: Ben Allen
Trades: 0
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, 02:15 AM Re: Crop image to set Co-ordinates
saadatshah's Avatar
Extreme Talker

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

http://www.developerfusion.co.uk/Uti...sharptovb.aspx
__________________
- -- --- ---- ----- ------ ------- ---------------
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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 1.27621 seconds with 12 queries