Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
e5fbf5c7
Commit
e5fbf5c7
authored
Oct 11, 2022
by
DepFA
Committed by
GitHub
Oct 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove embedding related image functions from images
parent
c080f52c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
77 deletions
+0
-77
modules/images.py
modules/images.py
+0
-77
No files found.
modules/images.py
View file @
e5fbf5c7
...
@@ -463,80 +463,3 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
...
@@ -463,80 +463,3 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
txt_fullfn
=
None
txt_fullfn
=
None
return
fullfn
,
txt_fullfn
return
fullfn
,
txt_fullfn
def
addCaptionLines
(
lines
,
image
,
initialx
,
textfont
):
draw
=
ImageDraw
.
Draw
(
image
)
hstart
=
initialx
for
fill
,
line
in
lines
:
fontSize
=
32
font
=
ImageFont
.
truetype
(
textfont
,
fontSize
)
_
,
_
,
w
,
h
=
draw
.
textbbox
((
0
,
0
),
line
,
font
=
font
)
fontSize
=
min
(
int
(
fontSize
*
((
image
.
size
[
0
]
-
35
)
/
w
)
),
28
)
font
=
ImageFont
.
truetype
(
textfont
,
fontSize
)
_
,
_
,
w
,
h
=
draw
.
textbbox
((
0
,
0
),
line
,
font
=
font
)
draw
.
text
(((
image
.
size
[
0
]
-
w
)
/
2
,
hstart
),
line
,
font
=
font
,
fill
=
fill
)
hstart
+=
h
return
hstart
def
captionImge
(
image
,
prelines
,
postlines
,
background
=
(
51
,
51
,
51
),
font
=
None
):
if
font
is
None
:
try
:
font
=
ImageFont
.
truetype
(
opts
.
font
or
Roboto
,
fontsize
)
font
=
opts
.
font
or
Roboto
except
Exception
:
font
=
Roboto
sampleImage
=
image
background
=
Image
.
new
(
"RGBA"
,
(
sampleImage
.
size
[
0
],
sampleImage
.
size
[
1
]
+
1024
),
background
)
hoffset
=
addCaptionLines
(
prelines
,
background
,
5
,
font
)
+
16
background
.
paste
(
sampleImage
,(
0
,
hoffset
))
hoffset
=
hoffset
+
sampleImage
.
size
[
1
]
+
8
hoffset
=
addCaptionLines
(
postlines
,
background
,
hoffset
,
font
)
background
=
background
.
crop
((
0
,
0
,
sampleImage
.
size
[
0
],
hoffset
+
8
))
return
background
def
captionImageOverlay
(
srcimage
,
title
,
footerLeft
,
footerMid
,
footerRight
,
textfont
=
None
):
from
math
import
cos
image
=
srcimage
.
copy
()
if
textfont
is
None
:
try
:
textfont
=
ImageFont
.
truetype
(
opts
.
font
or
Roboto
,
fontsize
)
textfont
=
opts
.
font
or
Roboto
except
Exception
:
textfont
=
Roboto
factor
=
1.5
gradient
=
Image
.
new
(
'RGBA'
,
(
1
,
image
.
size
[
1
]),
color
=
(
0
,
0
,
0
,
0
))
for
y
in
range
(
image
.
size
[
1
]):
mag
=
1
-
cos
(
y
/
image
.
size
[
1
]
*
factor
)
mag
=
max
(
mag
,
1
-
cos
((
image
.
size
[
1
]
-
y
)
/
image
.
size
[
1
]
*
factor
*
1.1
))
gradient
.
putpixel
((
0
,
y
),
(
0
,
0
,
0
,
int
(
mag
*
255
)))
image
=
Image
.
alpha_composite
(
image
.
convert
(
'RGBA'
),
gradient
.
resize
(
image
.
size
))
draw
=
ImageDraw
.
Draw
(
image
)
fontSize
=
32
font
=
ImageFont
.
truetype
(
textfont
,
fontSize
)
padding
=
10
_
,
_
,
w
,
h
=
draw
.
textbbox
((
0
,
0
),
title
,
font
=
font
)
fontSize
=
min
(
int
(
fontSize
*
(((
image
.
size
[
0
]
*
0.75
)
-
(
padding
*
4
))
/
w
)
),
72
)
font
=
ImageFont
.
truetype
(
textfont
,
fontSize
)
_
,
_
,
w
,
h
=
draw
.
textbbox
((
0
,
0
),
title
,
font
=
font
)
draw
.
text
((
padding
,
padding
),
title
,
anchor
=
'lt'
,
font
=
font
,
fill
=
(
255
,
255
,
255
,
230
))
_
,
_
,
w
,
h
=
draw
.
textbbox
((
0
,
0
),
footerLeft
,
font
=
font
)
fontSizeleft
=
min
(
int
(
fontSize
*
(((
image
.
size
[
0
]
/
3
)
-
(
padding
))
/
w
)
),
72
)
_
,
_
,
w
,
h
=
draw
.
textbbox
((
0
,
0
),
footerMid
,
font
=
font
)
fontSizemid
=
min
(
int
(
fontSize
*
(((
image
.
size
[
0
]
/
3
)
-
(
padding
))
/
w
)
),
72
)
_
,
_
,
w
,
h
=
draw
.
textbbox
((
0
,
0
),
footerRight
,
font
=
font
)
fontSizeright
=
min
(
int
(
fontSize
*
(((
image
.
size
[
0
]
/
3
)
-
(
padding
))
/
w
)
),
72
)
font
=
ImageFont
.
truetype
(
textfont
,
min
(
fontSizeleft
,
fontSizemid
,
fontSizeright
))
draw
.
text
((
padding
,
image
.
size
[
1
]
-
padding
),
footerLeft
,
anchor
=
'ls'
,
font
=
font
,
fill
=
(
255
,
255
,
255
,
230
))
draw
.
text
((
image
.
size
[
0
]
/
2
,
image
.
size
[
1
]
-
padding
),
footerMid
,
anchor
=
'ms'
,
font
=
font
,
fill
=
(
255
,
255
,
255
,
230
))
draw
.
text
((
image
.
size
[
0
]
-
padding
,
image
.
size
[
1
]
-
padding
),
footerRight
,
anchor
=
'rs'
,
font
=
font
,
fill
=
(
255
,
255
,
255
,
230
))
return
image
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