Skip to content

Commit

Permalink
v2.1更新
Browse files Browse the repository at this point in the history
  • Loading branch information
renzhezhilu committed Aug 16, 2020
1 parent f78fd0c commit 606bf95
Show file tree
Hide file tree
Showing 7 changed files with 736 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ canvas.toBlob(callback, type, encoderOptions);

[wasm-im ](https://github.com/mk33mk333/wasm-im)

[文章:WebAssembly实战-在浏览器中使用ImageMagick](https://cloud.tencent.com/developer/article/1554176)
[文章:WebAssembly实战-在浏览器中使用ImageMagick](https://cloud.tencent.com/developer/article/1554176)
_[(快照)](https://renzhezhilu.github.io/webp2jpg-online/doc/WebAssembly实战-在浏览器中使用ImageMagick.html)


29 changes: 29 additions & 0 deletions cdn/v2.1/app.js

Large diffs are not rendered by default.

388 changes: 388 additions & 0 deletions doc/WebAssembly实战-在浏览器中使用ImageMagick.html

Large diffs are not rendered by default.

25 changes: 18 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
var Module = {}
</script>
<script>
var version = 'v2.1.1'
var version = 'v2.1.2'
if (localStorage.getItem('version') !== version) {
localforage.clear()
console.log('版本更新');
Expand Down Expand Up @@ -115,10 +115,17 @@
name: 'wasm-im.wasm'
},
{
url: 'https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/dist_js/app02.js',
name: 'app.js'
url: 'https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/v2.1/app.js',
name: 'wasm-im.js'
},

// {
// url: 'https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/dist_js/chunk.js',
// name: 'chunk.js'
// },
// {
// url: 'https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/dist_js/app.js',
// name: 'app.js'
// },
]
let ok = []
get.map((m, index) => {
Expand All @@ -137,8 +144,12 @@
console.log('完成。。。。', ok);
Module.locateFile = _ => get.filter(m => m.name === 'wasm-im.wasm')[0].url

let s2 = get.filter(m => m.name === 'app.js')[0]
creatScript(s2.url, s2.name)
let s1 = get.filter(m => m.name === 'wasm-im.js')[0]
creatScript(s1.url, s1.name)
// let s2 = get.filter(m => m.name === 'chunk.js')[0]
// creatScript(s2.url, s2.name)
// let s3 = get.filter(m => m.name === 'app.js')[0]
// creatScript(s3.url, s3.name)

loading.style.display = 'none'
} else {
Expand All @@ -151,4 +162,4 @@
}
GO()
</script>
</body> </html>
</body> </html>
154 changes: 154 additions & 0 deletions index_v2.0.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<!DOCTYPE html>
<html lang=en>

<head>
<meta charset=utf-8>
<title>webp2jpg-online-在线图片格式转化器(无需上传)-web2jpg-Online image format converter (no upload required)-web2jpg-オンライン画像形式コンバーター(アップロード不要)-web2jpg-Convertidor de formato de imagen en línea (no requiere carga)</title>
<meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
<meta name=viewport content="width=device-width,initial-scale=1">
<meta name=description content="在线图片格式转化器,可将jpeg、jpg、png、gif、webp、svg、ico、bmp文件转化为jpeg、png、webp、ico文件。无需上传文件,本地即可完成转换。Online picture format converter, can convert jpeg, jpg, png, gif, webp, svg, ico, bmp files into jpeg, png, webp, ico files. No need to upload files, conversion can be done locally。オンライン画像形式コンバータは、jpeg、jpg、png、gif、webp、svg、ico、bmpファイルをjpeg、png、webp、icoファイルに変換できます。 ファイルをアップロードする必要はありません。変換はローカルで実行できます。Convertidor de formato de imagen en línea, puede convertir archivos jpeg, jpg, png, gif, webp, svg, ico, bmp en archivos jpeg, png, webp, ico. No es necesario cargar archivos, la conversión se puede hacer localmente">
<meta name=author content=renzhezhilu,https://github.com/renzhezhilu/webp2jpg-online> <meta name=keywords content="webp2jpg,png2jpg,gif2jpg,svg2jpg,ico2jpg,bmp2jpg,jpg2webp,jpg2webp,png2webp,gif2webp,svg2webp,ico2webp,bmp2webp,jpg2png,webp2png,gif2png,svg2png,ico2png,bmp2png,webp to jpg,png to jpg,gif to jpg,svg to jpg,ico to jpg,bmp to jpg,jpg to webp,jpg to webp,png to webp,gif to webp,svg to webp,ico to webp,bmp to webp,jpg to png,webp to png,gif to png,svg to png,ico to png,bmp to png,webp 转 jpg,png 转 jpg,gif 转 jpg,svg 转 jpg,ico 转 jpg,bmp 转 jpg,jpg 转 webp,jpg 转 webp,png 转 webp,gif 转 webp,svg 转 webp,ico 转 webp,bmp 转 webp,jpg 转 png,webp 转 png,gif 转 png,svg 转 png,ico 转 png,bmp 转 png,html图片转换,图片本地转换,图片格式转换,,转化至jpg、webp、png、ico,Convert to JPG,Convert to webp,Convert to png,Convert to ico">
<meta name=robots content="webp2jpg,png2jpg,gif2jpg,svg2jpg,ico2jpg,bmp2jpg,jpg2webp,jpg2webp,png2webp,gif2webp,svg2webp,ico2webp,bmp2webp,jpg2png,webp2png,gif2png,svg2png,ico2png,bmp2png,webp to jpg,png to jpg,gif to jpg,svg to jpg,ico to jpg,bmp to jpg,jpg to webp,jpg to webp,png to webp,gif to webp,svg to webp,ico to webp,bmp to webp,jpg to png,webp to png,gif to png,svg to png,ico to png,bmp to png,webp 转 jpg,png 转 jpg,gif 转 jpg,svg 转 jpg,ico 转 jpg,bmp 转 jpg,jpg 转 webp,jpg 转 webp,png 转 webp,gif 转 webp,svg 转 webp,ico 转 webp,bmp 转 webp,jpg 转 png,webp 转 png,gif 转 png,svg 转 png,ico 转 png,bmp 转 png,html图片转换,图片本地转换,图片格式转换,,转化至jpg、webp、png、ico,Convert to JPG,Convert to webp,Convert to png,Convert to ico">
<meta name=google content="webp2jpg,png2jpg,gif2jpg,svg2jpg,ico2jpg,bmp2jpg,jpg2webp,jpg2webp,png2webp,gif2webp,svg2webp,ico2webp,bmp2webp,jpg2png,webp2png,gif2png,svg2png,ico2png,bmp2png,webp to jpg,png to jpg,gif to jpg,svg to jpg,ico to jpg,bmp to jpg,jpg to webp,jpg to webp,png to webp,gif to webp,svg to webp,ico to webp,bmp to webp,jpg to png,webp to png,gif to png,svg to png,ico to png,bmp to png,webp 转 jpg,png 转 jpg,gif 转 jpg,svg 转 jpg,ico 转 jpg,bmp 转 jpg,jpg 转 webp,jpg 转 webp,png 转 webp,gif 转 webp,svg 转 webp,ico 转 webp,bmp 转 webp,jpg 转 png,webp 转 png,gif 转 png,svg 转 png,ico 转 png,bmp 转 png,html图片转换,图片本地转换,图片格式转换,,转化至jpg、webp、png、ico,Convert to JPG,Convert to webp,Convert to png,Convert to ico">
<meta name=googlebot content="webp2jpg,png2jpg,gif2jpg,svg2jpg,ico2jpg,bmp2jpg,jpg2webp,jpg2webp,png2webp,gif2webp,svg2webp,ico2webp,bmp2webp,jpg2png,webp2png,gif2png,svg2png,ico2png,bmp2png,webp to jpg,png to jpg,gif to jpg,svg to jpg,ico to jpg,bmp to jpg,jpg to webp,jpg to webp,png to webp,gif to webp,svg to webp,ico to webp,bmp to webp,jpg to png,webp to png,gif to png,svg to png,ico to png,bmp to png,webp 转 jpg,png 转 jpg,gif 转 jpg,svg 转 jpg,ico 转 jpg,bmp 转 jpg,jpg 转 webp,jpg 转 webp,png 转 webp,gif 转 webp,svg 转 webp,ico 转 webp,bmp 转 webp,jpg 转 png,webp 转 png,gif 转 png,svg 转 png,ico 转 png,bmp 转 png,html图片转换,图片本地转换,图片格式转换,,转化至jpg、webp、png、ico,Convert to JPG,Convert to webp,Convert to png,Convert to ico">
<meta name=baidu content="webp2jpg,png2jpg,gif2jpg,svg2jpg,ico2jpg,bmp2jpg,jpg2webp,jpg2webp,png2webp,gif2webp,svg2webp,ico2webp,bmp2webp,jpg2png,webp2png,gif2png,svg2png,ico2png,bmp2png,webp to jpg,png to jpg,gif to jpg,svg to jpg,ico to jpg,bmp to jpg,jpg to webp,jpg to webp,png to webp,gif to webp,svg to webp,ico to webp,bmp to webp,jpg to png,webp to png,gif to png,svg to png,ico to png,bmp to png,webp 转 jpg,png 转 jpg,gif 转 jpg,svg 转 jpg,ico 转 jpg,bmp 转 jpg,jpg 转 webp,jpg 转 webp,png 转 webp,gif 转 webp,svg 转 webp,ico 转 webp,bmp 转 webp,jpg 转 png,webp 转 png,gif 转 png,svg 转 png,ico 转 png,bmp 转 png,html图片转换,图片本地转换,图片格式转换,,转化至jpg、webp、png、ico,Convert to JPG,Convert to webp,Convert to png,Convert to ico">
<meta name=verify content="webp2jpg,png2jpg,gif2jpg,svg2jpg,ico2jpg,bmp2jpg,jpg2webp,jpg2webp,png2webp,gif2webp,svg2webp,ico2webp,bmp2webp,jpg2png,webp2png,gif2png,svg2png,ico2png,bmp2png,webp to jpg,png to jpg,gif to jpg,svg to jpg,ico to jpg,bmp to jpg,jpg to webp,jpg to webp,png to webp,gif to webp,svg to webp,ico to webp,bmp to webp,jpg to png,webp to png,gif to png,svg to png,ico to png,bmp to png,webp 转 jpg,png 转 jpg,gif 转 jpg,svg 转 jpg,ico 转 jpg,bmp 转 jpg,jpg 转 webp,jpg 转 webp,png 转 webp,gif 转 webp,svg 转 webp,ico 转 webp,bmp 转 webp,jpg 转 png,webp 转 png,gif 转 png,svg 转 png,ico 转 png,bmp 转 png,html图片转换,图片本地转换,图片格式转换,,转化至jpg、webp、png、ico,Convert to JPG,Convert to webp,Convert to png,Convert to ico">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black-translucent>
<meta name=format-detection content="telephone=no, email=no">
<meta name=HandheldFriendly content=true>
<meta name=MobileOptimized content=320>
<meta property=og:site_name content="webp2jpg-online-Picture converter">
<meta property=og:title content="webp2jpg-online-在线图片格式转化器(无需上传)-web2jpg-Online image format converter (no upload required)">
<meta property=og:description content="在线图片格式转化器,可将jpeg、jpg、png、gif、webp、svg、ico、bmp文件转化为jpeg、png、webp、ico文件。无需上传文件,本地即可完成转换。Online picture format converter, can convert jpeg, jpg, png, gif, webp, svg, ico, bmp files into jpeg, png, webp, ico files. No need to upload files, conversion can be done locally。オンライン画像形式コンバータは、jpeg、jpg、png、gif、webp、svg、ico、bmpファイルをjpeg、png、webp、icoファイルに変換できます。 ファイルをアップロードする必要はありません。変換はローカルで実行できます。Convertidor de formato de imagen en línea, puede convertir archivos jpeg, jpg, png, gif, webp, svg, ico, bmp en archivos jpeg, png, webp, ico. No es necesario cargar archivos, la conversión se puede hacer localmente">
<meta property=og:image content=https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/og_image.png> <meta property=og:url content=https://renzhezhilu.github.io/webp2jpg-online/>
<meta property=og:type content=article>
<link rel=apple-touch-icon href=https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/apple-touch-iphone.png> <link rel="shortcut icon" href=https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/favicon.ico> <style>#page_loading {
position: fixed;
z-index: 10000;
width: 100%;
height: 100%;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
font-size: 26px;
line-height: 26px;
font-weight: 100;
font-family: Avenir, "微软雅黑", Helvetica, Arial, sans-serif;
}

#page_loading,
#page_loading * {
list-style: none;
box-sizing: border-box;
padding: 0;
margin: 0;
}</style>
</head>

<body>
<div id=page_loading>
<div>
<div><span id=page_loading_num style="font-size:80px;line-height: 80px;">0</span> %</div>
<p>loading...</p>
</div>
</div><noscript><strong>We're sorry but v.2.0.0 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript>
<div id=app></div>
<script src=https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/localforage.min.js> </script> <script>
var Module = {}
</script>
<script>
var version = 'v2.1.1'
if (localStorage.getItem('version') !== version) {
localforage.clear()
console.log('版本更新');
}

function creatScript(src, name) {
let body = document.querySelector('body')
let script = document.createElement('script')
script.src = src
script.className = name
body.appendChild(script)
}
async function fileSaveLocal(fileUrl, name) {
try {
const isHave = await localforage.getItem(name);
if (isHave) {
console.log('本地已存在');
let val = await localforage.getItem(name)
console.log(val);
return {
url: URL.createObjectURL(val),
local: true,
name: name
}
} else {
console.log('本地不存在,重新请求');
let blob = await fetch(fileUrl)
.then(d => d.blob())

await localforage.setItem(name, blob)
let val = await localforage.getItem(name)
console.log(val);
return {
url: URL.createObjectURL(val),
local: false,
name: name
}
}
} catch (err) {
console.log(err);
}
}



async function GO() {
let loading = document.getElementById('page_loading')
let num = document.getElementById('page_loading_num')
let wasmjs_dom = document.getElementById('wasmjs')

let get = [{
url: 'https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/wasm-im.wasm',
name: 'wasm-im.wasm'
},
{
url: 'https://cdn.jsdelivr.net/gh/renzhezhilu/webp2jpg-online/cdn/dist_js/app02.js',
name: 'app.js'
},

]
let ok = []
get.map((m, index) => {
fileSaveLocal(m.url, m.name)
.then(d => {
ok.push(d)
get = get.map(m => {
ok.map(a => {
if (a.name === m.name) m.url = a.url
})
return m
})
num.textContent = ((index / get.length * 100).toFixed(0) - 0)
if (ok.length === get.length) {
if (ok.every(e => e.local)) {
console.log('完成。。。。', ok);
Module.locateFile = _ => get.filter(m => m.name === 'wasm-im.wasm')[0].url

let s2 = get.filter(m => m.name === 'app.js')[0]
creatScript(s2.url, s2.name)

loading.style.display = 'none'
} else {
localStorage.setItem('version', version)
location.reload()
}
}
})
})
}
GO()
</script>
</body> </html>
8 changes: 6 additions & 2 deletions test/输出文件固定size02_ok.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ <h4 id="t2"></h4>
console.error(blob22, qu, URL.createObjectURL(blob22), '没有符合的🙅');
return
}
if (qu < 0.0001 && bSize < setSize) {
console.warn(blob22, qu, URL.createObjectURL(blob22), '最小输出✅');
return
}
//微调
if (bSize < setSize) {
qu = qu + skip
Expand All @@ -87,9 +91,9 @@ <h4 id="t2"></h4>
}
setSizeFun(setSize, qu.toFixed(2) - 0)

}, `image/jpeg`, qu)
}, `image/webp`, qu)
}
}, `image/jpeg`, 0.81)
}, `image/webp`, 0.81)
}
}, false)
</script>
Expand Down
Loading

0 comments on commit 606bf95

Please sign in to comment.