Issue for crating Skia's SkImage object for SVG Image Format

138 views
Skip to first unread message

Ninad Dafale

unread,
Jun 1, 2023, 8:49:25 AM6/1/23
to skia-discuss
I have built Skia statically. My code runs perfectly when I try to take a snapshot of images in formats such as JPG, PNG, GIF, BMP, and WebP.
However, I'm encountering an issue when attempting to create a snapshot of SVG image files (or any other image format).
When I try to create a SkImage object using the following line of code, it results in a segmentation fault:

sk_sp<SkImage> image = SkImages::DeferredFromEncodedData(data);

where data is encode data from -> data = SkData::MakeFromFileName(image_path);

According to Skia documentation, not all image formats are supported natively.
I would like to find a solution that allows me to use the DeferredFromEncodedData method to obtain an SkImage object for SVG images or any other image format.
I have already tried configuring Skia with the "skia_enable_svg=true" argument, but unfortunately, that did not resolve the issue.

My goal is to take a snapshot of an image regardless of its format, Can anyone provide guidance on the correct configuration to achieve this?

thank you..!!

craste...@gmail.com

unread,
Jun 1, 2023, 11:23:49 AM6/1/23
to skia-discuss
I have never tried what you are suggesting, but I know that SVG is not a raster image file format.  It is vector and can include multiple raster images within it.
Reply all
Reply to author
Forward
0 new messages