Compress images when pasted into Obsidian

I frequently screen shot + paste into Obsidian notes. E.g. I am watching someone give a zoom presentation, so I screen shot slides and paste them into a note. As a result, I’ve got over 1 gig of images in my notes. This becomes a pain when I then push to github. Would be good if before saving the images, they could be passed through an image compression algorithm.

13 Likes

this is a great idea. This is essential specially for image heavy notes. A big reason why I avoid to have too many images is because of this fact.

I also push things to a private repo in github for backup, but I also have my Notes of Drobox for quick syncing, since I only have a free 2GB storage, images are definetly a problem.


Even for Obsidian sync, I’m not sure what will end up being the storage limit, but having smaller size images would still be beneficial.


As a plugin

Of course not everyone will want their image qualities to downgrade, which is why ithink a plugin that allows the user to compress to a certain degree (50% compression, 25% compression) or even dimensions, that’d be great.

1 Like

Only if this was optional I‘d agree.

4 Likes

yeah I feel it would need to be an optional feature, in the best of cases with a nice settings panel to choose the level of compression.

but in the simplest of versions even just a toggle in the settings

with a toggle for

compression -⟐---- no compression

2 Likes

@Andorin , I recomend you the ‘imgurl’ plugin. It allows you to store images in imgur, and avoid keeping binaries in your GIT.

It also unlocks other possibilities, such as

  1. Copy paste a part of your note and send it to a friend, with all the images.
  2. Re-use images between vaults.

I’m super happy with it :slight_smile:

https://github.com/gavvvr/obsidian-imgur-plugin

4 Likes

that’s an awesome suggestion, thanks @cristian I’ll try it out

Great idea in principle, thanks for suggesting @christian. Many of the images that I post are confidential though, so while it’s unlikely anything of commercial value would get posted & seen… I probably shouldn’t do that with every image that I take a note of (which is -a lot-).

I also don’t really like the idea that all my images could get deleted if/when imgur goes bankrupt.

Another alternative could be to seperate where the images get saved from where the notes are saved. Then the notes could be pushed to github, while the images are just backed up to e.g. gdrive/onedrive/dropbox

1 Like

I think this could be easy to set up,

  1. Configure the attachment folder path, for example, ‘images’
  2. Add this folder to the file .gitignore, so GIT does not version it.
  3. Link the attachment folder path to dropbox. (in Linux would be to make a symbolic link)

Why not compress images into avif image format??

1 Like

Keep in mind that Imgur deletes un-viewed images after 6 months. I have lost multiple images that were hosted on Imgur over the last 10 years. I will never use their service anymore unless it is for a temporary image share.

6 Likes

Waw! this is good info!. thanks

1 Like

There’s a new plugin that should help with this: musug/obsidian-paste-png-to-jpeg: When pasting screenshots into obsidian notes, convert the images to jpeg and compress them.

4 Likes

Would it be possible to build something like what ImageOptim does into Obsidian?

Source code:

It could be optionally enabled, as suggested above, since it does add some CPU overhead?

I’m manually doing this now going forward with images I drag into notes, which I in turn use primarily to build tutorials for my students.

I saw a 50% reduction in total size of image assets, a pretty incredible improvement.

2 Likes

Hi All, I’ve come here from Open question - Using the Imgur plugin, how secure is it, into the future?, thanks to @Olondre for directing me here :grinning:

I use ShareX - The best free and open source screenshot tool for Windows

You can set it to save in .jpg, and set the compression level to your preference

image

(I’ve been uploading my non-sensitive images to Imgur for the past year, and have now decided it has to stop, so what now, I enjoy visually interesting notes)

Exactly what I was thinking, after having used it extensively for a year!

This is what I’m now considering.

Anyhow, hope this helps with image compression :thinking:

1 Like

I too saw this plugin and was wondering if anybody had any reviews on it.

1 Like

Have you looked at the image converter plugin? GitHub - xRyul/obsidian-image-converter: ⚡️ Convert and compress images from one format to another by drag'n'dropping or pasting files into the note.

3 Likes

GitHub - xRyul/obsidian-image-converter: ⚡️ Convert and compress images from one format to another by drag'n'dropping or pasting files into the note.

Thank you! I was not aware of this plugin. Works very well.

Hi All, if anyone reading this is still thinking about image compression, I just posted my successful attempt here Compressing images in the Assets folder to reduce its total size :+1: