Forum Moderators: open

Message Too Old, No Replies

Image manipulation

chop off a section

         

mattglet

6:56 pm on Dec 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a 100x100 pixel image. Is it possible in classic ASP or .NET to chop off a 10x10 pixel section of the corner? It's kind of like reverse cropping. I can't just turn the corner into a transparent color, I need to have it non-existant.

If you take out the dots (I had to use them for formatting purposes in the forum), you'll see a before and after.
_____
¦......¦
¦......¦
______

... ____
__¦....¦
¦.......¦
¦.......¦
______

asp4bunnies

7:03 pm on Dec 14, 2005 (gmt 0)

10+ Year Member



Yes, it's possible. Are you planning on cropping out someone else's watermark or something?

mattglet

8:12 pm on Dec 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, not at all... In a nutshell I'm building an application that will need to have the ability to fit images around other images. So if an image doesn't fit in a spot, I need to make it fit.

asp4bunnies

1:18 am on Dec 15, 2005 (gmt 0)

10+ Year Member



I think what you're asking to do is physically impossible. All embedded media is in the form of a rectangle. You can't change the embedded shape to a non-rectangle. To crop off a piece requires that you fill up the area with transparent or blank space. Text won't naturally wrap around it.

However, you can achieve a similar effect using CSS and partially embedding an image behind text. You can also achieve something like this with flash. I'd recommend you not go either route though.

john_k

6:40 am on Dec 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It can be done. Use your code to do the same thing you would do manually. That is, you will need to split the image and then display the parts in a table.

Determine the dimensions of the image. For this example let's say it is 150x100.

Create ImageA using the rectangle from 9,0 to 149,9.
Create ImageB using the rectangle from 0,10 to 149,99.
Then render a table with these rows:
<tr><td></td><td><img src="ImageA" width="140" height="10"/></td></tr>
<tr><td colspan="2"><img src="ImageB" width="150" height="90"/></td></tr>

john_k

7:05 am on Dec 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, after re-reading your original post, I think you could just draw a 10x10 white rectangle over the top left corner.

If you want to do it dynamically at the browser, then you could create one or more DIVs over the image.

mrMister

11:56 am on Dec 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As well as presenting the images on top of each other using layers (CSS) as has been siuggested, you could merge the images using GDI+, this would require less bandwidth for the end user.

flyerguy

11:50 pm on Dec 28, 2005 (gmt 0)

10+ Year Member



I suggest doing a search for 'ASP JPEG'.

There are at least 3 quality components for IIS that I know and have used that allow you to dynamically do a 'Picture-in-picture'-style combination of different images, or, if you so desire, inserting a blank space in your image.

You can also easily draw text using any TTF system font with these components.

This will require a hosting environment where you are allowed to install such components, or you will have to find a host who already has such components installed in their packages.

mrMister

10:02 am on Jan 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This will require a hosting environment where you are allowed to install such components, or you will have to find a host who already has such components installed in their packages.

.Net includes such features by default.