Fast JPG thumbnail creation? (downsampling)

44 views
Skip to first unread message

Stefan O.

unread,
Jan 30, 2024, 8:36:35 AM1/30/24
to skia-discuss
I'm looking for a fast and memory efficient way to downsample a JPG.

On Android there is BitmapFactory.Options.inSampleSize, but how would I do this using SKIA through skiko bindings on JVM?

Right now I load a full resolution image and create my thumbnail using SkCanvas drawImageRect, but this takes its time and memory. I need something faster for processing thousands of images.

Can someone show me an example how to scale down a big image to a thumbnail with the longest side of 480px?

Mike Reed

unread,
Jan 31, 2024, 12:33:49 PM1/31/24
to skia-d...@googlegroups.com
SkCodec::getScaledDimensions()

I think this class may do what you need.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/2aac13e9-1c54-4b63-8a91-8f27ff0b675fn%40googlegroups.com.


--
"I think I can safely say that nobody understands quantum mechanics." -- Richard Feynman
"It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so." -- Mark Twain
"I am pleased to see that we have differences" -- Surak

Stefan O.

unread,
Feb 2, 2024, 8:46:28 AM2/2/24
to skia-discuss
Looks plausible. Thank you! :)
Reply all
Reply to author
Forward
0 new messages