Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
2e520e03
Commit
2e520e03
authored
Jan 26, 2015
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send animated images verbatim
parent
ccc66d23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
chatwindow.py
blink/chatwindow.py
+13
-8
No files found.
blink/chatwindow.py
View file @
2e520e03
...
...
@@ -492,15 +492,20 @@ class Thumbnail(object):
def
__new__
(
cls
,
filename
):
image_reader
=
QImageReader
(
filename
)
if
image_reader
.
canRead
():
if
image_reader
.
supportsAnimation
()
and
image_reader
.
imageCount
()
>
1
:
image_format
=
str
(
image_reader
.
format
())
image_data
=
str
(
image_reader
.
device
()
.
readAll
())
else
:
image_size
=
image_reader
.
size
()
if
image_size
.
height
()
>
720
:
image_reader
.
setScaledSize
(
image_size
*
720
/
image_size
.
height
())
image
=
QPixmap
.
fromImageReader
(
image_reader
)
image_buffer
=
QBuffer
()
image_format
=
'png'
if
image
.
hasAlphaChannel
()
else
'jpeg'
image
.
save
(
image_buffer
,
image_format
)
image_data
=
str
(
image_buffer
.
data
())
instance
=
super
(
Thumbnail
,
cls
)
.
__new__
(
cls
)
image_size
=
image_reader
.
size
()
if
image_size
.
height
()
>
720
:
image_reader
.
setScaledSize
(
image_size
*
720
/
image_size
.
height
())
image
=
QPixmap
.
fromImageReader
(
image_reader
)
image_buffer
=
QBuffer
()
image_format
=
'png'
if
image
.
hasAlphaChannel
()
else
'jpeg'
image
.
save
(
image_buffer
,
image_format
)
instance
.
__dict__
[
'data'
]
=
str
(
image_buffer
.
data
())
instance
.
__dict__
[
'data'
]
=
image_data
instance
.
__dict__
[
'type'
]
=
'image/{}'
.
format
(
image_format
)
else
:
instance
=
None
...
...
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