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

fmt: ImageFormat.WEBP for encodeToBytes and encodeToBase64 can't compress image very well #2541

Open
gyhyfj opened this issue Jul 24, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@gyhyfj
Copy link

gyhyfj commented Jul 24, 2024

Description

Hope that fmt: ImageFormat.WEBP could reduce most size of normal png image, which couldn't.

@gyhyfj gyhyfj added the enhancement New feature or request label Jul 24, 2024
@wcandillon
Copy link
Contributor

Could you provide more information what the issue seems to be?

@gyhyfj
Copy link
Author

gyhyfj commented Jul 25, 2024

Could you provide more information what the issue seems to be?

For example, a .png image with a size of 3mb as input, when converted to webp by encodeToBytes, exported size will be about 2mb.
But that same png image after converted by ffmpeg with same quality will be about 100kb.

@wcandillon
Copy link
Contributor

wcandillon commented Jul 25, 2024 via email

@gyhyfj
Copy link
Author

gyhyfj commented Jul 26, 2024

It's a feature request

const input = await Skia.Data.fromURI(
  Image.resolveAssetSource(require('~/assets/test.png')).uri,
)
const image = Skia.Image.MakeImageFromEncoded(data)!
const output = image.encodeToBytes(ImageFormat.WEBP, 100)
// size of output is still large for saving and uploading, 
// hope to get a much smaller size with ImageFormat.WEBP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants