반응형
http://seikichi.github.io/tiff.js/tiff.min.js
tiff viewer 예제
http://seikichi.github.io/tiff.js/basic.html
<script src="//code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://seikichi.github.io/tiff.js/tiff.min.js"></script>
<script type="text/javascript">
$(function ()
{
var img_list = ["sample1.tif", "sample2.tif"];
var load_img = function (filename)
{
var xhr = new XMLHttpRequest();
xhr.open("GET", filename);
xhr.responseType = "arraybuffer";
xhr.onload = function (e)
{
var buffer = xhr.response;
var tiff = new Tiff({buffer: buffer});
var canvas = tiff.toCanvas();
var width = tiff.width();
var height = tiff.height();
if(canvas)
{
var $elem = $("<div><a href='" + filename + "'>" + filename + " (width: " + width + ", height:" + height + ")" + "</a></div>");
$elem.append(canvas);
$("body").append($elem);
}
};
xhr.send();
};
for(var i = 0, len = img_list.length; i < len; ++i)
{
load_img(img_list[i]);
}
});
</script>
반응형