Is there an API that can take the content from a div from a webpage and convert it into an image?
views:
28answers:
3
A:
In javascript you could do this with jquery:
$("div").replaceWith('<img />');
DiggyF
2010-07-17 07:03:42
Sorry, I didn't really phrase my question well, I've edited it now to be more clear.
ben
2010-07-17 07:45:15
+2
A:
Checkout thumbalizr. It also has an API.
Here's a 1280px
screenshot of this page.
To get just the div that you are interested in, find the div's offsets and dimensions, then use any image manipulation library to carve out those coordinates from the entire image starting at (offsetX, offsetY)
and having dimensions (width, height)
.
Anurag
2010-07-17 07:12:48
+1
A:
If the site which includes the div is in your control. Add a border in a unique color to the div. Then use extrenal service like thumbalizr to get the image and clip it in according to the unique color frame.
This setup can run via server side php/gd imagemagick. or similar (javascript/ . Net)
Nir
2010-07-17 07:25:46