Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1b070e72
authored
Jun 05, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【优化】canvas 下载图片
parent
520244ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
1 deletions
+1
-1
src/views/ai/image/ImageTask.vue
+1
-1
No files found.
src/views/ai/image/ImageTask.vue
View file @
1b070e72
...
@@ -77,7 +77,7 @@ const downloadImage = async (imageUrl) => {
...
@@ -77,7 +77,7 @@ const downloadImage = async (imageUrl) => {
const
canvas
=
document
.
createElement
(
'canvas'
)
const
canvas
=
document
.
createElement
(
'canvas'
)
canvas
.
width
=
image
.
width
canvas
.
width
=
image
.
width
canvas
.
height
=
image
.
height
canvas
.
height
=
image
.
height
const
ctx
=
canvas
.
getContext
(
'2d'
)
const
ctx
=
canvas
.
getContext
(
'2d'
)
as
CanvasDrawImage
ctx
.
drawImage
(
image
,
0
,
0
,
image
.
width
,
image
.
height
)
ctx
.
drawImage
(
image
,
0
,
0
,
image
.
width
,
image
.
height
)
const
url
=
canvas
.
toDataURL
(
'image/png'
)
const
url
=
canvas
.
toDataURL
(
'image/png'
)
const
a
=
document
.
createElement
(
'a'
)
const
a
=
document
.
createElement
(
'a'
)
...
...
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