javascript - CSS/JS: How do I copy the edge pixels and repeat them -


i have 960px banner (with multiple slides) , per request of client, should fill whole window width, not scaling. mentioned "pixel copying" have not yet found on it.

i have make banners edge (last 1px) repeat fit width; last left pixel should repeat left side , last right pixel should repeat right side.

i have in html/css/js, have not yet found solution, sure accomplish opening photoshop, client able change banner through backend , mentioned before; contains slides (changing each 5 seconds or so..)

i thinking like:

<script>    var img = new image();     img.src = 'image.jpg';     var context = document.getelementbyid('canvas').getcontext('2d');     context.drawimage(img, 0, 0);     data = context.getimagedata(x, y, 960, 1).data;     // ... what? </script> 

i found code on stackoverflow, problem not don't know how pixel , copy it, every pixel top bottom of banner needs repeated

any suggestions?

consider approach, using data urls: https://stackoverflow.com/a/9971339/36537

essentially create 1px wide canvas, set values banner pixels, , convert data url. pass data url css background image property.

to pixel values , copy them new canvas(es), follow information on mdn: pixel manipulation canvas


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -