xRyul / obsidian-image-converter

⚡️ Convert and compress images from one format to another by drag'n'dropping or pasting files into the note.
MIT License
111 stars 11 forks source link
jpg png webp

Image Converter for ObsidianMD

Sample 2

Features

Supported image formats: WEBP, JPG, PNG, HEIC, TIF

Quick Summary for Image Compression

The recommended export setting is WEBP set to Quality 75. This is the optimal setting for most types of images.

Example 1 - Comparison of Original converted to WEBP and JPG with Quality 1

https://github.com/xRyul/obsidian-image-converter/assets/47340038/52ffd607-e92c-4b08-bde4-8a389fd992fc

Example 2 - Comparison of Original converted to WEBP and JPG with Quality 1

https://github.com/xRyul/obsidian-image-converter/assets/47340038/6978be85-6f83-47ba-a9df-1f5864c6fbcb

Example 3 - Comparison between WEBB 100 vs JPG 100 > WEBB 1 vs JPG 1

https://github.com/xRyul/obsidian-image-converter/assets/47340038/aa62380e-b977-42c5-8a2f-71cb09a811b7

Comparison

File size of converting one image format to another:

From/To WEBP JPG PNG
JPG 64,122 KB (100)
7,482 KB (50)
480 KB (1)
52,864 KB (100)
5,926KB(50)
363KB(1)
96,556KB(100)
44,702KB(50)
9,072KB(1)
PNG 21,812KB(100)
1,520KB(50)
401KB(1)
14,744KB(100)
1,776KB(50)
163KB(1)
29,830KB(100)
12,161KB(50)
3,226KB(1)
WEBP 30,960KB(100)
1,414KB(50)
353KB(1)
19,236KB(100)
2,000KB(50)
189KB(1)
43,154KB(100)
15,327KB(50)
1,806KB(1)

File size difference after the conversion in %:

The percentage change is calculated by comparing the file size after conversion to the original file size of the image being converted.

From/To WEBP JPG PNG
JPG +21.4% (100)PSNR: 45.85
-85.9% (50)PSNR: 31.16
-99.1% (1)PSNR: 26.28
+29.3%(100)
-85.8%(50) PSNR:29.25
-99.3%(1) PSNR:23.2
+135.9%(100)
+8.9%(50)
-78%(1)
PNG -6.9%(100)PSNR: 34.78
-93.5%(50)PSNR: 29.23
-98.3%(1)PSNR: 23.52
-37%(100)PSNR: 35.07
-92.4%(50) PSNR: 28.62
-99.3%(1)PSNR: 19.52
+27.4%(100)
-48%(50)
-86.2%(1)
WEBP +8.8%(100)PSNR: 38.46
-95%(50)PSNR: 32.72
-98.8%(1)PSNR: 27.98
-32.4%(100)PSNR: 39.04
-93%(50)PSNR: 32.65
-99.3%(1)PSNR: 22.79
+51.8%(100)
-46.1%(50)
-93.6%(1)

PSNR and the loss of quality:

Below is the table which shows how much quality we lose with each conversion. The lower the PSNR value the lower the quality of an image:

From/To WEBP JPG PNG
JPG 45.85 (100)
31.16 (50) 29.25 (50)
26.28 (1) 23.2 (1)
PNG 34.78 (100) 35.07 (100)
29.23 (50) 28.62 (50)
23.52 (1) 19.52 (1)
WEBP 38.46 (100) 39.04 (100)
32.72 (50) 32.65 (50)
27.98 (1) 22.79 (1)

Conclusion

To-do

How to install

  1. Downlaod main.js, styles.css, manifest.json files from this repo.
  2. Creane new folder inside VaultFolder/.obsidian/plugins/ named obsidian-image-converter . If plugins folder doesn't exist, then create it manually.
  3. Move downloaded files into /obsidian-image-converter folder.
  4. Enable the plugin in ObsidianMD.

Credits