Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
2e4628ac
"...composable_kernel_onnx.git" did not exist on "a4f24233e51854c4b5cb7d75637fa0f235f78f8e"
Commit
2e4628ac
authored
Feb 18, 2024
by
comfyanonymous
Browse files
Merge branch 'iTXt-png-metadata-support' of
https://github.com/shiimizu/ComfyUI
parents
dccca1da
51714141
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
web/scripts/pnginfo.js
web/scripts/pnginfo.js
+2
-2
No files found.
web/scripts/pnginfo.js
View file @
2e4628ac
...
@@ -24,7 +24,7 @@ export function getPngMetadata(file) {
...
@@ -24,7 +24,7 @@ export function getPngMetadata(file) {
const
length
=
dataView
.
getUint32
(
offset
);
const
length
=
dataView
.
getUint32
(
offset
);
// Get the chunk type
// Get the chunk type
const
type
=
String
.
fromCharCode
(...
pngData
.
slice
(
offset
+
4
,
offset
+
8
));
const
type
=
String
.
fromCharCode
(...
pngData
.
slice
(
offset
+
4
,
offset
+
8
));
if
(
type
===
"
tEXt
"
||
type
==
"
comf
"
)
{
if
(
type
===
"
tEXt
"
||
type
==
"
comf
"
||
type
===
"
iTXt
"
)
{
// Get the keyword
// Get the keyword
let
keyword_end
=
offset
+
8
;
let
keyword_end
=
offset
+
8
;
while
(
pngData
[
keyword_end
]
!==
0
)
{
while
(
pngData
[
keyword_end
]
!==
0
)
{
...
@@ -33,7 +33,7 @@ export function getPngMetadata(file) {
...
@@ -33,7 +33,7 @@ export function getPngMetadata(file) {
const
keyword
=
String
.
fromCharCode
(...
pngData
.
slice
(
offset
+
8
,
keyword_end
));
const
keyword
=
String
.
fromCharCode
(...
pngData
.
slice
(
offset
+
8
,
keyword_end
));
// Get the text
// Get the text
const
contentArraySegment
=
pngData
.
slice
(
keyword_end
+
1
,
offset
+
8
+
length
);
const
contentArraySegment
=
pngData
.
slice
(
keyword_end
+
1
,
offset
+
8
+
length
);
const
contentJson
=
Array
.
from
(
contentArraySegment
).
map
(
s
=>
String
.
fromCharCode
(
s
)).
join
(
''
)
const
contentJson
=
new
TextDecoder
(
"
utf-8
"
).
decode
(
contentArraySegment
);
txt_chunks
[
keyword
]
=
contentJson
;
txt_chunks
[
keyword
]
=
contentJson
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment