Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attached image files grow in size and get corrupted meta info #2858

Closed
Diomas opened this issue Jan 31, 2019 · 4 comments · Fixed by #2961
Closed

Attached image files grow in size and get corrupted meta info #2858

Diomas opened this issue Jan 31, 2019 · 4 comments · Fixed by #2961
Labels
bug 🐛 Issue concerns a bug.

Comments

@Diomas
Copy link

Diomas commented Jan 31, 2019

Current behavior

When you drag an image file into a note, boostnote creates a new file in {storage_folder}\attachments\{note_id}\{some_hash}.jpg and insert a link to it. The problem is that new file size appears few times bigger than original one and its image metadata is corrupted (or deleted):

2019-01-31_18-26-15

Original file is 1.05 MB and has some usual image meta info:
image

Attached file is 9.13 MB and all meta is missed:
image
More over some programs like embedded window image viewer even don't recognize this file as an image.

Expected behavior

When I attach a file I expect it to be untouched (same file size, same meta info etc).

Steps to reproduce

  1. Drag'n'drop a JPG file into a note
  2. Compare attached file to original one

Environment

  • Version : 0.11.13
  • OS Version and name : Windows 10
@Diomas
Copy link
Author

Diomas commented Jan 31, 2019

Update: attached PNG images don't grow in their file size (the size becomes even slightly smaller), but they do loose all image metadata as JPG images do

@ZeroX-DG ZeroX-DG added the bug 🐛 Issue concerns a bug. label Feb 1, 2019
@zzxxhhzxh
Copy link

Acturally after attaching, the file is not a jpg anymore, it is a png format file, you can use some software to check it.

@MiloTodt
Copy link
Contributor

MiloTodt commented Mar 14, 2019

Issue looks to be related to lib/dataApi/attachmentManagement.js

In the function handleAttachmentDrop:
image

A call to fixRotate is made

image

fixRotate redraws the image by mapping it to a new canvas and saving. This would strip metadata and potentially change the file format.

What is the purpose of fixRotate? Is the issue fixRotate is designed to fix more common/important than not changing the metadata/file format? Maybe it can be removed entirely.

@ZeroX-DG
Copy link
Member

@MiloTodt The fix rotate function used to rotate the image into the right direction. You can take a look at this PR for more information: #2322

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Issue concerns a bug.
Projects
None yet
4 participants