Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix saving quality and mime
Signed-off-by: John Molakvoæ <[email protected]>
  • Loading branch information
skjnldsv committed Sep 21, 2022
commit 3f81cb0ee51820418fa3fee1f16c54d9a77a6540
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/components/ImageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ export default {
const putUrl = origin + join(dirname(pathname), fullName)
logger.debug('Saving image...', { putUrl, src: this.src, fullName })

// toBlob is not very smart...
mimeType = mimeType.replace('jpg', 'jpeg')

// Sanity check, 0 < quality < 1
quality = Math.max(Math.min(quality, 1), 0) || 1

try {
const blob = await new Promise(resolve => imageCanvas.toBlob(resolve, mimeType, quality))
const response = await axios.put(putUrl, new File([blob], fullName))
Expand Down