Compressing Images befor Importing into a Tiddler

I would like to scale down (pixel-wise) and compress (byte-wise) images on import.

I just discovered that I have unknowingly imported a 5967x4488 pixels image at 5.2 MBytes.

TW doesn’t contain any image compression algorithms. Usually they are huge and the good ones are compiled from desktop libraries to web-assembly. …

Have a closer look at: https://squoosh.app/ which is a SPA single page app that doesn’t send anything to a server.

It supports several image formats you can convert your image to. It defaults to MozJPEG, which is one of the best JPEG compressors.

AVIF is a very new format and should result in small images with good quality. … BUT you need to play with the parameters.

Screenshots are best compressed using PNG. JPEG makes screenshots ugly, because the compression algorithm is optimized for photos

2 Likes

@cdaven We can keep this kind of import idea on the list but set it aside given the reasoning @pmario has put.

  • However after import have you tried editing the image and changing the size?
  • Perhaps we can use that feature in the post import phase?

The extending of the Import handing in this OT is more about improved handing of the import process and what we can do to improve workflows and options.

I have solved my image problem a few times by “unwrapping” my single-file HTML to a folder with tiddler files, then running two utilities to resize large images and compress them.

Like so,

magick *.png -resize 1200x800\> -set filename:basename "%[basename]" "%[filename:basename].png"
oxipng --opt 3 --interlace 0 --strip safe --quiet *.png

I saved 5 MBytes by doing this today! :slight_smile:

1 Like

That would be a nice feature concerning images.

Another way, is by using IPFS resources in tiddlers
So TW can contain big files like videos and stay light :wink:

We are making a “run your own TW hosting service and invite friends to get hosted or become a new hosting service”…

For example:

This TW is hosted on “libra” from the “copylaradio.com” network
It is owned and controled by “fred@astroport.com”

https://ipfs.copylaradio.com/ipns/fred.astroport.com.libra.copylaradio.com

We wish to make it available and easy to install to any IPFS node soon

1 Like

Right!

Footnote: As someone working routinely with huge images (some are 3gb or more) I am aware of the issue.

Specialised independent utilities to both compress and resample for target use are the way to go, I think?

Just a comment, TT