Android icon indicating copy to clipboard operation
Android copied to clipboard

Use jpeg to store images

Open matsievskiysv opened this issue 3 years ago • 11 comments

Using JPEG may significantly reduce images size. For example, one of my cards is 1M in png and 70k in jpg, My exported card archive is 150M in png and 3M in jpeg.

matsievskiysv avatar Jun 01 '22 16:06 matsievskiysv

I would assume that switching it to JPEG would break the use case of users who use things like company logos with transparency.

Maybe we can somehow detect if any transparency is used and if not, compress to JPEG? Is JPEG always smaller or just most of the time?

TheLastProject avatar Jun 01 '22 19:06 TheLastProject

Is JPEG always smaller or just most of the time?

If it is a photo, it will be smaller in jpeg. But indeed it does not support alpha channel.

matsievskiysv avatar Jun 02 '22 03:06 matsievskiysv

Is JPEG always smaller or just most of the time?

You can choose different compression levels, but yes jpeg may reduce size quite a bit :)

Altonss avatar Jun 17 '22 19:06 Altonss

@TheLastProject We can give the choice of either exporting to png or jpeg.

I can work on it.

Shanta-11 avatar Oct 09 '22 14:10 Shanta-11

We can give the choice of either exporting to png or jpeg.

I understand your suggestion, but I'm not really a fan of it. I don't think the average user should care about what image format is used, it should "just work"

TheLastProject avatar Oct 09 '22 15:10 TheLastProject

JPEG and PNG have completely different usage:

  • JPEG is great for photos, altering the image a litlle but reaching a good compression ratio
  • PNG uses color palette to do compression, which is great for logos (no compression artefacts, and better compression level when there are only a few colors in the image with sharp edges). Plus it supports transparency.

For catima, JPEG is better when people take a picture of their card with their camera, but PNG is better when you just download the logo from a website and use it as your card image.

mic006 avatar Oct 20 '22 13:10 mic006

Hey all, I also stumbled across the storage usage of Catima in the past, too (150MB with 22 cards). Can we decrease image sizes somehow? Whether it is through image compression or storing the images in a smaller dimensions or resolutions.

klawdhfzasjhaa avatar Dec 01 '24 23:12 klawdhfzasjhaa

Right now images are saved with 90% quality. I'm not sure about decreasing that as it may increase the risk of artifacts.

However, I do think your idea of a smaller dimension/resolution is a good idea. Maybe a good start would be to export -> change file resolutions -> import and figure out an WxH for image thumbnails and other images that still looks good but saves a good chunk of storage (I'm sure thumbnails will be able to be smaller than front/back images).

Then we could just make sure Catima always ensures the width and height are below those values before saving an image. If we make the values high enough people should still be able to somewhat zoom in and read text hopefully.

TheLastProject avatar Dec 02 '24 21:12 TheLastProject

Also, we should check if the uCrop change https://github.com/Yalantis/uCrop/pull/926 also affects Catima somehow.

TheLastProject avatar Dec 02 '24 21:12 TheLastProject